This simple script retrieves a secret of your choice from SecretsManager using the Lambda's provided event. Simply provide the payload:
{
"secret":"<identifier>"
}
where identifier
is either the ID of the secret or the ARN of it.
aws_lambda_powertools |
from aws_lambda_powertools.utilities import parameters | |
def handler(event,context): | |
value = parameters.get_secret(event["secret"]) | |
print(value) |