forked from saha-rajdeep/cloudformation-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rds-with-secrets.yaml
24 lines (24 loc) · 924 Bytes
/
rds-with-secrets.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
AWSTemplateFormatVersion: 2010-09-09
Description: >-
AWS CloudFormation Template tyo demonstrate creating a secret
and using it in a RDS instance
Resources:
MyRDSSecrets:
Type: AWS::SecretsManager::Secret
Properties:
Description: 'This is the secret for my RDS instance'
GenerateSecretString:
SecretStringTemplate: '{"username": "admin"}'
GenerateStringKey: 'password'
PasswordLength: 16
ExcludeCharacters: '"@/\'
MyDBInstance:
Type: AWS::RDS::DBInstance
Properties:
AllocatedStorage: 20
DBInstanceClass: db.t2.micro
Engine: mysql
MasterUsername: !Join ['', ['{{resolve:secretsmanager:', !Ref MyRDSSecrets, ':SecretString:username}}' ]]
MasterUserPassword: !Join ['', ['{{resolve:secretsmanager:', !Ref MyRDSSecrets, ':SecretString:password}}' ]]
BackupRetentionPeriod: 0
DBInstanceIdentifier: 'rds-instance'