Skip to content

Instantly share code, notes, and snippets.

@mims92
Last active November 3, 2021 12:19
Show Gist options
  • Save mims92/0b4016f6f8fd7ed121ee4d259d08ffac to your computer and use it in GitHub Desktop.
Save mims92/0b4016f6f8fd7ed121ee4d259d08ffac to your computer and use it in GitHub Desktop.
AWS - Python - Retrieve a value from the Parameter Store
#####################################################################
# Runs on AWS Lambda
# Please make sure the role as the getParameters access.
# -> AmazonSSMFullAccess for simplicity
#
# Boto3 library is already included.
# Documentation: http://boto3.readthedocs.io/en/latest/reference/services/ssm.html#SSM.Client.describe_parameters
#####################################################################
import boto3
client = boto3.client('ssm')
def lambda_handler(event, context):
response = client.get_parameter(Name='YOUR_TAG_NAME')
return response['Parameter']['Value']
@deastland
Copy link

If the parameter is encrypted, the response = line should read:

response = client.get_parameter(Name='YOUR_TAG_NAME', WithDecryption=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment