Created
February 16, 2024 06:21
-
-
Save sgsharma/233dc07f4c000a5df02b9f1d6b437c18 to your computer and use it in GitHub Desktop.
Get SSM parameter value from lambda
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
| # boto3 docs here: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ssm/client/get_parameter.html | |
| # make sure lambda role has policy/AmazonSSMFullAccess | |
| import boto3 | |
| client = boto3.client('ssm') | |
| def get_ssm_param(param: str) -> str: | |
| session = boto3.session.Session() | |
| ssm = session.client("ssm") | |
| return ssm.get_parameter(Name=param, WithDecryption=True)['Parameter']['Value'] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment