Created
February 11, 2020 19:53
-
-
Save DavidJFelix/e04b29b39a79289e06ac9e3377b0f021 to your computer and use it in GitHub Desktop.
How I setup my VPC
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
AWSTemplateFormatVersion: '2010-09-09' | |
Metadata: | |
License: Apache-2.0 | |
Parameters: | |
CidrBlocks: | |
Description: FIXME Remove. The CIDR blocks to use for the subnets in the services VPC. | |
Default: '10.0.0.0/24,10.0.1.0/24,10.0.2.0/24,10.0.3.0/24,10.0.4.0/24,10.0.5.0/24' | |
Type: CommaDelimitedList | |
Ipv6CidrBlocks: | |
Description: FIXME Remove. The IPv6 CIDR blocks to use for the subnets in the services VPC. | |
Type: CommaDelimitedList | |
VpcCidrBlock: | |
Description: The CIDR block to use for the services VPC. | |
Default: '10.0.0.0/16' | |
Type: String | |
Resources: | |
ExternalUsEast1aSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AssignIpv6AddressOnCreation: true | |
AvailabilityZone: us-east-1a | |
CidrBlock: !Select | |
- 6 | |
- !Ref CidrBlocks | |
Ipv6CidrBlock: !Select | |
- 6 | |
- !Ref Ipv6CidrBlocks | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:External:Us:East:1a | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcId: !Ref Vpc | |
DependsOn: | |
- VpcVPCCidrBlock | |
ExternalUsEast1aSubnetRouteTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref VpcRouteTable | |
SubnetId: !Ref ExternalUsEast1aSubnet | |
ExternalUsEast1bSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AssignIpv6AddressOnCreation: true | |
AvailabilityZone: us-east-1b | |
CidrBlock: !Select | |
- 7 | |
- !Ref CidrBlocks | |
Ipv6CidrBlock: !Select | |
- 7 | |
- !Ref Ipv6CidrBlocks | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:External:Us:East:1b | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcId: !Ref Vpc | |
DependsOn: | |
- VpcVPCCidrBlock | |
ExternalUsEast1bSubnetRouteTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref VpcRouteTable | |
SubnetId: !Ref ExternalUsEast1bSubnet | |
ExternalUsEast1cSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AssignIpv6AddressOnCreation: true | |
AvailabilityZone: us-east-1c | |
CidrBlock: !Select | |
- 8 | |
- !Ref CidrBlocks | |
Ipv6CidrBlock: !Select | |
- 8 | |
- !Ref Ipv6CidrBlocks | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:External:Us:East:1c | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcId: !Ref Vpc | |
DependsOn: | |
- VpcVPCCidrBlock | |
ExternalUsEast1cSubnetRouteTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref VpcRouteTable | |
SubnetId: !Ref ExternalUsEast1cSubnet | |
ExternalUsEast1dSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AssignIpv6AddressOnCreation: true | |
AvailabilityZone: us-east-1d | |
CidrBlock: !Select | |
- 9 | |
- !Ref CidrBlocks | |
Ipv6CidrBlock: !Select | |
- 9 | |
- !Ref Ipv6CidrBlocks | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:External:Us:East:1d | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcId: !Ref Vpc | |
DependsOn: | |
- VpcVPCCidrBlock | |
ExternalUsEast1dSubnetRouteTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref VpcRouteTable | |
SubnetId: !Ref ExternalUsEast1dSubnet | |
ExternalUsEast1eSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AssignIpv6AddressOnCreation: true | |
AvailabilityZone: us-east-1e | |
CidrBlock: !Select | |
- 10 | |
- !Ref CidrBlocks | |
Ipv6CidrBlock: !Select | |
- 10 | |
- !Ref Ipv6CidrBlocks | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:External:Us:East:1e | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcId: !Ref Vpc | |
DependsOn: | |
- VpcVPCCidrBlock | |
ExternalUsEast1eSubnetRouteTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref VpcRouteTable | |
SubnetId: !Ref ExternalUsEast1eSubnet | |
ExternalUsEast1fSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AssignIpv6AddressOnCreation: true | |
AvailabilityZone: us-east-1f | |
CidrBlock: !Select | |
- 11 | |
- !Ref CidrBlocks | |
Ipv6CidrBlock: !Select | |
- 11 | |
- !Ref Ipv6CidrBlocks | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:External:Us:East:1f | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcId: !Ref Vpc | |
DependsOn: | |
- VpcVPCCidrBlock | |
ExternalUsEast1fSubnetRouteTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref VpcRouteTable | |
SubnetId: !Ref ExternalUsEast1fSubnet | |
InternalUsEast1aSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AssignIpv6AddressOnCreation: true | |
AvailabilityZone: us-east-1a | |
CidrBlock: !Select | |
- 0 | |
- !Ref CidrBlocks | |
Ipv6CidrBlock: !Select | |
- 0 | |
- !Ref Ipv6CidrBlocks | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:Internal:Us:East:1a | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcId: !Ref Vpc | |
DependsOn: | |
- VpcVPCCidrBlock | |
InternalUsEast1aSubnetRouteTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref VpcRouteTable | |
SubnetId: !Ref InternalUsEast1aSubnet | |
InternalUsEast1bSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AssignIpv6AddressOnCreation: true | |
AvailabilityZone: us-east-1b | |
CidrBlock: !Select | |
- 1 | |
- !Ref CidrBlocks | |
Ipv6CidrBlock: !Select | |
- 1 | |
- !Ref Ipv6CidrBlocks | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:Internal:Us:East:1b | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcId: !Ref Vpc | |
DependsOn: | |
- VpcVPCCidrBlock | |
InternalUsEast1bSubnetRouteTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref VpcRouteTable | |
SubnetId: !Ref InternalUsEast1bSubnet | |
InternalUsEast1cSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AssignIpv6AddressOnCreation: true | |
AvailabilityZone: us-east-1c | |
CidrBlock: !Select | |
- 2 | |
- !Ref CidrBlocks | |
Ipv6CidrBlock: !Select | |
- 2 | |
- !Ref Ipv6CidrBlocks | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:Internal:Us:East:1c | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcId: !Ref Vpc | |
DependsOn: | |
- VpcVPCCidrBlock | |
InternalUsEast1cSubnetRouteTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref VpcRouteTable | |
SubnetId: !Ref InternalUsEast1cSubnet | |
InternalUsEast1dSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AssignIpv6AddressOnCreation: true | |
AvailabilityZone: us-east-1d | |
CidrBlock: !Select | |
- 3 | |
- !Ref CidrBlocks | |
Ipv6CidrBlock: !Select | |
- 3 | |
- !Ref Ipv6CidrBlocks | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:Internal:Us:East:1d | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcId: !Ref Vpc | |
DependsOn: | |
- VpcVPCCidrBlock | |
InternalUsEast1dSubnetRouteTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref VpcRouteTable | |
SubnetId: !Ref InternalUsEast1dSubnet | |
InternalUsEast1eSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AssignIpv6AddressOnCreation: true | |
AvailabilityZone: us-east-1e | |
CidrBlock: !Select | |
- 4 | |
- !Ref CidrBlocks | |
Ipv6CidrBlock: !Select | |
- 4 | |
- !Ref Ipv6CidrBlocks | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:Internal:Us:East:1e | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcId: !Ref Vpc | |
DependsOn: | |
- VpcVPCCidrBlock | |
InternalUsEast1eSubnetRouteTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref VpcRouteTable | |
SubnetId: !Ref InternalUsEast1eSubnet | |
InternalUsEast1fSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
AssignIpv6AddressOnCreation: true | |
AvailabilityZone: us-east-1f | |
CidrBlock: !Select | |
- 5 | |
- !Ref CidrBlocks | |
Ipv6CidrBlock: !Select | |
- 5 | |
- !Ref Ipv6CidrBlocks | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:Internal:Us:East:1f | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcId: !Ref Vpc | |
DependsOn: | |
- VpcVPCCidrBlock | |
InternalUsEast1fSubnetRouteTableAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref VpcRouteTable | |
SubnetId: !Ref InternalUsEast1fSubnet | |
Vpc: | |
Type: AWS::EC2::VPC | |
Properties: | |
CidrBlock: !Ref VpcCidrBlock | |
EnableDnsSupport: true | |
EnableDnsHostnames: true | |
InstanceTenancy: default | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:Services | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcDefaultSecurityGroupInternetIngress: | |
Type: AWS::EC2::SecurityGroupIngress | |
Properties: | |
CidrIp: '0.0.0.0/0' | |
IpProtocol: '-1' | |
GroupId: !GetAtt Vpc.DefaultSecurityGroup | |
VpcDefaultSecurityGroupInternetIpv6Ingress: | |
Type: AWS::EC2::SecurityGroupIngress | |
Properties: | |
CidrIpv6: '::/0' | |
IpProtocol: '-1' | |
GroupId: !GetAtt Vpc.DefaultSecurityGroup | |
VpcInternetGateway: | |
Type: AWS::EC2::InternetGateway | |
Properties: | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:Services | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcInternetGatewayRoute: | |
Type: AWS::EC2::Route | |
Properties: | |
DestinationCidrBlock: '0.0.0.0/0' | |
GatewayId: !Ref VpcInternetGateway | |
RouteTableId: !Ref VpcRouteTable | |
VpcRouteTable: | |
Type: AWS::EC2::RouteTable | |
Properties: | |
Tags: | |
- Key: Application | |
Value: Services | |
- Key: Name | |
Value: !Sub ${AWS::StackName}:Services | |
- Key: Stack | |
Value: !Ref AWS::StackName | |
VpcId: !Ref Vpc | |
VpcVPCCidrBlock: | |
Type: AWS::EC2::VPCCidrBlock | |
Properties: | |
AmazonProvidedIpv6CidrBlock: true | |
VpcId: !Ref Vpc | |
VpcVPCGatewayAttachment: | |
Type: AWS::EC2::VPCGatewayAttachment | |
Properties: | |
InternetGatewayId: !Ref VpcInternetGateway | |
VpcId: !Ref Vpc | |
Outputs: | |
ExternalSubnetUsEast1a: | |
Value: !Ref ExternalUsEast1aSubnet | |
Description: The subnet created for the VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:ExternalSubnet:UsEast1a | |
ExternalSubnetUsEast1b: | |
Value: !Ref ExternalUsEast1bSubnet | |
Description: The subnet created for the VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:ExternalSubnet:UsEast1b | |
ExternalSubnetUsEast1c: | |
Value: !Ref ExternalUsEast1cSubnet | |
Description: The subnet created for the VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:ExternalSubnet:UsEast1c | |
ExternalSubnetUsEast1d: | |
Value: !Ref ExternalUsEast1dSubnet | |
Description: The subnet created for the VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:ExternalSubnet:UsEast1d | |
ExternalSubnetUsEast1e: | |
Value: !Ref ExternalUsEast1eSubnet | |
Description: The subnet created for the VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:ExternalSubnet:UsEast1e | |
ExternalSubnetUsEast1f: | |
Value: !Ref ExternalUsEast1fSubnet | |
Description: The subnet created for the VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:ExternalSubnet:UsEast1f | |
InternalSubnetUsEast1a: | |
Value: !Ref InternalUsEast1aSubnet | |
Description: The subnet created for the VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:InternalSubnet:UsEast1a | |
InternalSubnetUsEast1b: | |
Value: !Ref InternalUsEast1bSubnet | |
Description: The subnet created for the VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:InternalSubnet:UsEast1b | |
InternalSubnetUsEast1c: | |
Value: !Ref InternalUsEast1cSubnet | |
Description: The subnet created for the VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:InternalSubnet:UsEast1c | |
InternalSubnetUsEast1d: | |
Value: !Ref InternalUsEast1dSubnet | |
Description: The subnet created for the VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:InternalSubnet:UsEast1d | |
InternalSubnetUsEast1e: | |
Value: !Ref InternalUsEast1eSubnet | |
Description: The subnet created for the VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:InternalSubnet:UsEast1e | |
InternalSubnetUsEast1f: | |
Value: !Ref InternalUsEast1fSubnet | |
Description: The subnet created for the VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:InternalSubnet:UsEast1f | |
Vpc: | |
Value: !Ref Vpc | |
Description: The created VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:ServicesVpc | |
VpcCidr: | |
Value: !GetAtt Vpc.CidrBlock | |
Description: The IPv4 CIDR block associated with the VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:ServicesVpc:Cidr | |
VpcCidrIpv6: | |
Value: !Select | |
- 0 | |
- !GetAtt Vpc.Ipv6CidrBlocks | |
Description: The IPv6 CIDR block associated with the VPC for services | |
Export: | |
Name: !Sub ${AWS::StackName}:ServicesVpc:CidrIpv6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment