Skip to content

Instantly share code, notes, and snippets.

@sgsharma
Created February 16, 2024 06:21
Show Gist options
  • Save sgsharma/233dc07f4c000a5df02b9f1d6b437c18 to your computer and use it in GitHub Desktop.
Save sgsharma/233dc07f4c000a5df02b9f1d6b437c18 to your computer and use it in GitHub Desktop.
Get SSM parameter value from lambda
# 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