Created
February 15, 2020 02:20
-
-
Save georgmao/34539df031d38a8020460b00c8dad81e to your computer and use it in GitHub Desktop.
Sample SAM template using various ways to store secrets
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
Resources: | |
ApiFunction: | |
Type: AWS::Serverless::Function | |
Properties: | |
Environment: | |
Variables: | |
# this is a standard lambda env var | |
user: "This is a regular env var" | |
# this is a var loaded from SSM | |
userFromSSM: '{{resolve:ssm:username:1}}' | |
# this is a var loaded from secrets manager | |
userFromSecretsManager: !Sub '{{resolve:secretsmanager:${RDSDBSecret}:SecretString:username}}' | |
RDSDBSecret: | |
Type: AWS::SecretsManager::Secret | |
Properties: | |
Name: MySecretForRDSProxy | |
Description: "This secret has a dynamically generated secret password." | |
SecretString: '{"username": "admin", "password": "somepassword", "engine": "mysql", "host":"database-1.cluster-asdfasdfasd.us-east-2.rds.amazonaws.com","port": 3306,"dbClusterIdentifier": "database-1"}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment