9

i am trying to develop a code where i can access and then modify and update the SSM parameter value .

Anyone , could you let me know how can this be achieved with boto3

Sumanth Shetty
  • 587
  • 1
  • 8
  • 19

2 Answers2

9

we can achieve modification by the following:

response = ssm.put_parameter(
 Name='field_name',
 Value='new_value',
 Type='Type',
 Overwrite=True



)

we can achieve read by the following

response = ssm.get_parameters(
Names=[
    'feild_name',
]


)
print(response['Parameters'][0]['Value'])
Sumanth Shetty
  • 587
  • 1
  • 8
  • 19
5

You can read and write an already created parameter with this code:

import boto3

ssm_client = boto3.client('ssm')

def get_parameter(name):
    parameter = ssm_client.get_parameter(Name=name)
    return parameter['Parameter']['Value']

def update_parameter(name, value):
    ssm_client.put_parameter(
        Name=name,
        Overwrite=True,
        Value=value,
    )

You can read the full documentation here

Martin Forte
  • 774
  • 13
  • 17