From 08708011b8b534668fbb3a9e6fc4492b57550a52 Mon Sep 17 00:00:00 2001 From: dtomlinson Date: Wed, 29 Apr 2020 02:25:57 +0100 Subject: [PATCH] adding cloudformation templates --- .cloudformation/02-stack-vpc.yaml | 93 +++++++++++++++++++++++ .cloudformation/03-stack-rdsinstance.yaml | 13 ++++ 2 files changed, 106 insertions(+) create mode 100644 .cloudformation/02-stack-vpc.yaml create mode 100644 .cloudformation/03-stack-rdsinstance.yaml diff --git a/.cloudformation/02-stack-vpc.yaml b/.cloudformation/02-stack-vpc.yaml new file mode 100644 index 0000000..53a46a6 --- /dev/null +++ b/.cloudformation/02-stack-vpc.yaml @@ -0,0 +1,93 @@ +AWSTemplateFormatVersion: 2010-09-09 +Description: VPC and Subnet definitions for Strapi + ELB project. +Resources: + PublicVPC: + Type: AWS::EC2::VPC + Properties: + CidrBlock: "172.31.0.0/16" + EnableDnsHostnames: true + EnableDnsSupport: true + PublicSubnet0: + Type: AWS::EC2::Subnet + Properties: + AvailabilityZone: + Fn::Select: + - 0 + - Fn::GetAZs: !Ref "AWS::Region" + VpcId: !Ref PublicVPC + CidrBlock: 172.31.0.0/20 + MapPublicIpOnLaunch: true + PublicSubnet1: + Type: AWS::EC2::Subnet + Properties: + AvailabilityZone: + Fn::Select: + - 1 + - Fn::GetAZs: !Ref "AWS::Region" + VpcId: !Ref PublicVPC + CidrBlock: 172.31.16.0/20 + MapPublicIpOnLaunch: true + PublicSubnet2: + Type: AWS::EC2::Subnet + Properties: + AvailabilityZone: + Fn::Select: + - 2 + - Fn::GetAZs: !Ref "AWS::Region" + VpcId: !Ref PublicVPC + CidrBlock: 172.31.32.0/20 + MapPublicIpOnLaunch: true + InternetGateway: + Type: AWS::EC2::InternetGateway + InternetGatewayAttachment: + Type: AWS::EC2::VPCGatewayAttachment + Properties: + VpcId: !Ref PublicVPC + InternetGatewayId: !Ref InternetGateway + PublicRouteTable: + Type: AWS::EC2::RouteTable + Properties: + VpcId: !Ref PublicVPC + PublicRoute: + Type: AWS::EC2::Route + DependsOn: InternetGatewayAttachment + Properties: + RouteTableId: !Ref PublicRouteTable + DestinationCidrBlock: 0.0.0.0/0 + GatewayId: !Ref InternetGateway + PublicSubnet0RouteTableAssociation: + Type: AWS::EC2::SubnetRouteTableAssociation + Properties: + SubnetId: !Ref PublicSubnet0 + RouteTableId: !Ref PublicRouteTable + PublicSubnet1RouteTableAssociation: + Type: AWS::EC2::SubnetRouteTableAssociation + Properties: + SubnetId: !Ref PublicSubnet1 + RouteTableId: !Ref PublicRouteTable + PublicSubnet2RouteTableAssociation: + Type: AWS::EC2::SubnetRouteTableAssociation + Properties: + SubnetId: !Ref PublicSubnet2 + RouteTableId: !Ref PublicRouteTable +Outputs: + PublicVPCID: + Description: The VPC ID. + Value: !Ref PublicVPC + Export: + Name: ELBStrapiPublicVPC + PublicSubnet0ID: + Description: The ID of the subnet. + Value: !Ref PublicSubnet0 + Export: + Name: ELBStrapiSubnet0 + PublicSubnet1ID: + Description: The ID of the subnet. + Value: !Ref PublicSubnet1 + Export: + Name: ELBStrapiSubnet1 + PublicSubnet2ID: + Description: The ID of the subnet. + Value: !Ref PublicSubnet2 + Export: + Name: ELBStrapiSubnet2 diff --git a/.cloudformation/03-stack-rdsinstance.yaml b/.cloudformation/03-stack-rdsinstance.yaml new file mode 100644 index 0000000..4826da5 --- /dev/null +++ b/.cloudformation/03-stack-rdsinstance.yaml @@ -0,0 +1,13 @@ +AWSTemplateFormatVersion: 2010-09-09 +Description: RDS and settings for ELB strapi deployment. +Metadata: + +Parameters: + +Mappings: + +Conditions: + +Resources: + +Outputs: