Skip to content

Commit

Permalink
add a simple rds instance template
Browse files Browse the repository at this point in the history
  • Loading branch information
regmicmahesh committed Jun 26, 2024
1 parent 3156b25 commit 538b514
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions RDS/simple-postgresql-instance.yaml
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

0 comments on commit 538b514

Please sign in to comment.