Created
August 14, 2020 14:20
-
-
Save viktorfa/cb0e1d4ebe1a22cdb8468f682e948873 to your computer and use it in GitHub Desktop.
Cloudformation template for creating an Aurora database in the Serverless framework.
This file contains 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
# cloudformation/aurora.yml | |
Resources: | |
RDSCluster: | |
Type: AWS::RDS::DBCluster | |
Properties: | |
MasterUsername: DBUsername | |
MasterUserPassword: DBPassword | |
DatabaseName: DBName | |
Engine: aurora | |
EngineMode: serverless | |
ScalingConfiguration: | |
AutoPause: true | |
MaxCapacity: 1 | |
MinCapacity: 1 | |
SecondsUntilAutoPause: 300 | |
DeletionProtection: false | |
DBSubnetGroupName: !Ref RDSSubnetGroup | |
VpcSecurityGroupIds: | |
- !GetAtt SecurityGroup.GroupId | |
VPC: | |
Type: AWS::EC2::VPC | |
Properties: | |
CidrBlock: 172.32.0.0/16 | |
EnableDnsSupport: true | |
EnableDnsHostnames: true | |
InstanceTenancy: default | |
SubnetA: | |
Type: AWS::EC2::Subnet | |
Properties: | |
CidrBlock: 172.32.0.0/20 | |
AvailabilityZone: !Select [0, !GetAZs ''] | |
MapPublicIpOnLaunch: true | |
VpcId: !Ref VPC | |
SubnetB: | |
Type: AWS::EC2::Subnet | |
Properties: | |
CidrBlock: 172.32.16.0/20 | |
AvailabilityZone: !Select [1, !GetAZs ''] | |
MapPublicIpOnLaunch: true | |
VpcId: !Ref VPC | |
SubnetC: | |
Type: AWS::EC2::Subnet | |
Properties: | |
CidrBlock: 172.32.32.0/20 | |
AvailabilityZone: !Select [2, !GetAZs ''] | |
MapPublicIpOnLaunch: true | |
VpcId: !Ref VPC | |
SecurityGroup: | |
Type: AWS::EC2::SecurityGroup | |
Properties: | |
GroupName: ${ self:service }-security-group | |
GroupDescription: "Security group for RDS" | |
SecurityGroupIngress: | |
- IpProtocol: tcp | |
FromPort: 3306 | |
ToPort: 3306 | |
- IpProtocol: tcp | |
FromPort: 3306 | |
ToPort: 3306 | |
CidrIp: 0.0.0.0/0 | |
VpcId: !Ref VPC | |
RDSSubnetGroup: | |
Type: AWS::RDS::DBSubnetGroup | |
Properties: | |
DBSubnetGroupDescription: "Subnet group for RDS" | |
SubnetIds: | |
- !Ref SubnetA | |
- !Ref SubnetB | |
- !Ref SubnetC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment