Last active
November 3, 2021 12:19
-
-
Save mims92/0b4016f6f8fd7ed121ee4d259d08ffac to your computer and use it in GitHub Desktop.
AWS - Python - Retrieve a value from the Parameter Store
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##################################################################### | |
# 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'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If the parameter is encrypted, the response = line should read:
response = client.get_parameter(Name='YOUR_TAG_NAME', WithDecryption=True)