Created
March 14, 2019 22:14
-
-
Save xschildw/555d65d5503eca898a7216e34140525b to your computer and use it in GitHub Desktop.
restore-rds-db
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
| Description: AWS CloudFormation template to create an RDS instance for the warehouse workers build | |
| Parameters: | |
| DBAllocatedStorage: | |
| Default: '5' | |
| Description: The size of the database (Gb) | |
| Type: Number | |
| DBClass: | |
| Default: db.t2.large | |
| Description: Database instance class | |
| Type: String | |
| DBSnapshotArn: | |
| Description: The ARN of the snapshot to restore | |
| Type: String | |
| Subnets: | |
| Description: List of subnetIds spanning 2 availability zones | |
| Type: List<AWS::EC2::Subnet::Id> | |
| VpcId: | |
| Description: VpcId of the VPC to deploy in | |
| Type: AWS::EC2::VPC::Id | |
| Resources: | |
| DBSubnetGroup: | |
| Type: AWS::RDS::DBSubnetGroup | |
| Properties: | |
| DBSubnetGroupDescription: Subnets for DB instance | |
| SubnetIds: !Ref 'Subnets' | |
| VpcSecurityGroup: | |
| Type: AWS::EC2::SecurityGroup | |
| Properties: | |
| GroupDescription: Security group for DB instances | |
| VpcId: !Ref 'VpcId' | |
| SecurityGroupIngress: | |
| - | |
| Description: "VPN traffic" | |
| CidrIp: '10.1.0.0/16' | |
| FromPort: 3306 | |
| ToPort: 3306 | |
| IpProtocol: 'tcp' | |
| SecurityGroupEgress: | |
| - | |
| Description: "All traffic" | |
| CidrIp: '0.0.0.0/0' | |
| FromPort: 3306 | |
| ToPort: 3306 | |
| IpProtocol: 'tcp' | |
| # Needed? | |
| # - | |
| # Description: "SageVpc - Private1" | |
| # CidrIp: '10.12.48.0/20' | |
| # FromPort: '3306' | |
| # ToPort: '3306' | |
| # IpProtocol: 'tcp' | |
| DB: | |
| Type: AWS::RDS::DBInstance | |
| Properties: | |
| AllocatedStorage: !Ref 'DBAllocatedStorage' | |
| DBInstanceClass: !Ref 'DBClass' | |
| DBSnapshotIdentifier: !Ref 'DBSnapshotArn' | |
| DBSubnetGroupName: !Ref 'DBSubnetGroup' | |
| Engine: MySQL | |
| EngineVersion: 5.6.34 | |
| VPCSecurityGroups: | |
| - !Ref 'VpcSecurityGroup' | |
| Outputs: | |
| JDBCConnectionString: | |
| Description: JDBC connection string for database instance | |
| Value: !Join | |
| - '' | |
| - - jdbc:mysql:// | |
| - !GetAtt 'DB.Endpoint.Address' | |
| - !GetAtt 'DB.Endpoint.Port' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment