Last active
January 10, 2018 13:42
-
-
Save porjo/9dd03ed6ba96fb98bd80 to your computer and use it in GitHub Desktop.
Cloudformation RDS
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
{ | |
"AWSTemplateFormatVersion" : "2010-09-09", | |
"Description" : "Test Stack - RDS", | |
"Parameters" : { | |
"VPCId": { | |
"Description" : "Id of an existing VPC to use for RDS server", | |
"Type": "AWS::EC2::VPC::Id", | |
"ConstraintDescription" : "must be the name of an existing VPC Id." | |
}, | |
"RDSSnapshot" : { | |
"Description" : "RDS Snapshot identifier (name) to restore from. Leave blank to create an empty database. Only used in 'test' environment.", | |
"Default" : "giga-iops", | |
"Type" : "String" | |
}, | |
"RDSParamGroup" : { | |
"Description" : "RDS parameter group name to apply to the instance. Only used in 'test' environment.", | |
"Default" : "prod-params", | |
"Type" : "String" | |
}, | |
"SubnetIds": { | |
"Type": "CommaDelimitedList", | |
"Description": "The list of SubnetIds, for at least two Availability Zones in the region in your Virtual Private Cloud (VPC)" | |
} | |
}, | |
"Resources" : { | |
"TestDB" : { | |
"Type" : "AWS::RDS::DBInstance", | |
"Properties" : { | |
"DBInstanceIdentifier" : "cfn-test", | |
"VPCIdSecurityGroups" : [ | |
{"Ref" : "TestDBSecurityGroup"} | |
], | |
"AllocatedStorage" : "1000", | |
"PubliclyAccessible": false, | |
"MultiAZ": false, | |
"StorageEncrypted": false, | |
"StorageType": "gp2", | |
"BackupRetentionPeriod": "0", | |
"DBInstanceClass" : "db.t2.medium", | |
"Engine" : "MySQL", | |
"MasterUsername" : "root", | |
"MasterUserPassword" : "MyPassword", | |
"DBSnapshotIdentifier" : { "Ref" : "RDSSnapshot" }, | |
"DBParameterGroupName" : { "Ref" : "RDSParamGroup" }, | |
"DBSubnetGroupName": { "Ref": "TestDBSubnetGroup" }, | |
"Tags" : [ | |
{ "Key" : "Name", "Value" : "cfn" } | |
] | |
} | |
}, | |
"TestDBSubnetGroup": { | |
"Type": "AWS::RDS::DBSubnetGroup", | |
"Properties": { | |
"DBSubnetGroupDescription": "Subnet available for the RDS DB Instance. Only used in *test* environment", | |
"SubnetIds": { "Ref": "SubnetIds" }, | |
"Tags" : [ | |
{ "Key" : "Name", "Value" : "cfn" } | |
] | |
} | |
}, | |
"TestDBSecurityGroup" : { | |
"Type" : "AWS::EC2::SecurityGroup", | |
"Properties" : { | |
"GroupDescription" : "Enable MySQL access from web servers. Only used in *test* environment", | |
"VpcId": { "Ref": "VPCId" }, | |
"SecurityGroupIngress" : [ | |
{ | |
"IpProtocol" : "tcp", | |
"FromPort" : "3306", | |
"ToPort" : "3306", | |
"CidrIp" : "192.168.1.0/24" | |
} | |
], | |
"Tags" : [ | |
{ "Key" : "Name", "Value" : "cfn" } | |
] | |
} | |
} | |
}, | |
"Outputs" : { | |
"TestRDSHostname" : { | |
"Description" : "Hostname of test RDS instance", | |
"Value" : { "Fn::GetAtt" : [ "TestDB", "Endpoint.Address" ]} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment