Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
my_string = """
your string \n seperated \n by \n new \n lines.
"""
account_id = '12345678910'
region = 'eu-west-1'
parameter_name = 'some-secret-name'
key_id = 'your-key-id'
kms_key_id = 'arn:aws:kms:{region}:{account_id}:key/{key_id}'.format(region=region, account_id=account_id, key_id=key_id)
ssm = boto3.client('ssm')
response = ssm.put_parameter(
Name=parameter_name,
Description='My encrypted secret blob',
Value=my_string,
Type='SecureString',
KeyId=kms_key_id,
Overwrite=True,
)
response = ssm.get_parameter(
Name=parameter_name,
WithDecryption=True
)
print(response.get('Parameter', {}).get('Value'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment