Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save suz-lab/7d8774bf97a60057f09a to your computer and use it in GitHub Desktop.
Save suz-lab/7d8774bf97a60057f09a to your computer and use it in GitHub Desktop.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"ProjectName": {
"Type": "String",
"Default": "suzlab"
},
"VpcId": {
"Type": "AWS::EC2::VPC::Id",
"Default": "vpc-aaaaaaaa"
},
"Az1SubnetId": {
"Type": "AWS::EC2::Subnet::Id",
"Default": "subnet-bbbbbbbb"
},
"Az2SubnetId": {
"Type": "AWS::EC2::Subnet::Id",
"Default": "subnet-cccccccc"
},
"VpcSecurityGroup": {
"Type": "AWS::EC2::SecurityGroup::Id",
"Default": "sg-dddddddd"
}
},
"Resources": {
"DbSubnetGroup": {
"Type": "AWS::RDS::DBSubnetGroup",
"Properties": {
"DBSubnetGroupDescription": { "Ref": "ProjectName" },
"SubnetIds": [
{ "Ref": "Az1SubnetId" },
{ "Ref": "Az2SubnetId" }
]
}
},
"DbInstance": {
"Type": "AWS::RDS::DBInstance",
"Properties": {
"Engine": "MySQL",
"DBSubnetGroupName": { "Ref": "DbSubnetGroup" },
"AllocatedStorage": "5",
"DBInstanceClass": "db.t2.micro",
"DBInstanceIdentifier": { "Ref": "ProjectName" },
"MasterUsername": { "Ref": "ProjectName" },
"MasterUserPassword": { "Fn::Join" : [ "", [
{ "Ref": "ProjectName" },
"!Z3"
] ] },
"VPCSecurityGroups": [ { "Ref": "VpcSecurityGroup"} ]
}
},
"HostedZone": {
"Type": "AWS::Route53::HostedZone",
"Properties": {
"Name": { "Fn::Join" : [ "", [
{ "Ref": "ProjectName" },
".local"
] ] },
"VPCs": [ {
"VPCId": { "Ref": "VpcId" },
"VPCRegion": { "Ref": "AWS::Region" }
} ]
}
},
"RdsRecordSet": {
"Type": "AWS::Route53::RecordSet",
"Properties": {
"HostedZoneId": { "Ref": "HostedZone" },
"Name": { "Fn::Join" : [ "", [
"rds.",
{ "Ref": "ProjectName" },
".local."
] ] },
"Type": "CNAME",
"TTL": "60",
"ResourceRecords": [
{ "Fn::GetAtt": [ "DbInstance", "Endpoint.Address" ] }
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment