Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement