-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3156b25
commit 538b514
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
AWSTemplateFormatVersion: "2010-09-09" | ||
|
||
Parameters: | ||
DBIdentifierName: | ||
Description: Identifier for the Database Instance. | ||
Type: String | ||
|
||
DBUsername: | ||
Description: Master username for the database. | ||
Type: String | ||
Default: postgresql | ||
|
||
DBPassword: | ||
Description: Master password for the database. | ||
Type: String | ||
NoEcho: true | ||
|
||
SecurityGroupIds: | ||
Description: Security Group Ids to attach in the instance. | ||
Type: List<AWS::EC2::SecurityGroup::Id> | ||
|
||
SubnetIds: | ||
Description: Subnet Ids to deploy the instance into. | ||
Type: List<AWS::EC2::Subnet::Id> | ||
|
||
DBName: | ||
Description: NAme of the initially created database . | ||
Type: String | ||
|
||
Metadata: | ||
cfn-lint: | ||
config: | ||
ignore_checks: | ||
- W1011 # this check is makes sure the DBPassword is passed through SSM Parameter Store for security reasons which is not valid in this case. | ||
|
||
Resources: | ||
Instance: | ||
Type: AWS::RDS::DBInstance | ||
DeletionPolicy: Snapshot | ||
UpdateReplacePolicy: Snapshot | ||
Properties: | ||
DBInstanceIdentifier: !Ref DBIdentifierName | ||
DBName: !Ref DBName | ||
Engine: postgres | ||
MultiAZ: false | ||
MasterUsername: !Ref DBUsername | ||
MasterUserPassword: !Ref DBPassword | ||
DBInstanceClass: db.t3.small | ||
AllocatedStorage: "20" | ||
DBSubnetGroupName: !Ref SubnetGroup | ||
VPCSecurityGroups: !Ref SecurityGroupIds | ||
|
||
SubnetGroup: | ||
Type: AWS::RDS::DBSubnetGroup | ||
Properties: | ||
DBSubnetGroupName: !Sub ${DBIdentifierName}SubnetGroup | ||
DBSubnetGroupDescription: !Sub DB Subnet Group for Private Subnet - ${DBIdentifierName} | ||
SubnetIds: !Ref SubnetIds | ||
|
||
Outputs: | ||
InstanceID: | ||
Description: RDS | ||
Value: !Ref Instance | ||
|
||
Endpoint: | ||
Description: RDS | ||
Value: !GetAtt Instance.Endpoint.Address |