AWSTemplateFormatVersion: 2010-09-09 Description: This template builds the VPC, public and private subnets, NAT gateway, and several Security Groups (qs-1s0p493i2) Parameters: VpcCidr: Type: String PublicSubnetCidr: Type: String PrivateSubnetCidr: Type: String AvailabilityZone: Type: String Resources: VPC: Type: "AWS::EC2::VPC" Properties: EnableDnsSupport: true EnableDnsHostnames: true CidrBlock: !Ref VpcCidr Tags: - Key: Name Value: !Sub "${AWS::StackName} - Studio-Q Quickstart" PublicSubnet: Type: "AWS::EC2::Subnet" Properties: VpcId: !Ref VPC CidrBlock: !Ref PublicSubnetCidr AvailabilityZone: !Ref AvailabilityZone Tags: - Key: Name Value: !Sub "${AWS::StackName} - Public" PrivateSubnet: Type: "AWS::EC2::Subnet" Properties: VpcId: !Ref VPC CidrBlock: !Ref PrivateSubnetCidr AvailabilityZone: !Ref AvailabilityZone Tags: - Key: Name Value: !Sub "${AWS::StackName} - Private" InternetGateway: Type: "AWS::EC2::InternetGateway" Properties: Tags: - Key: Name Value: !Sub "${AWS::StackName} - Studio-Q Quickstart" VPCGatewayAttachment: Type: "AWS::EC2::VPCGatewayAttachment" Properties: VpcId: !Ref VPC InternetGatewayId: !Ref InternetGateway PublicRouteTable: Type: "AWS::EC2::RouteTable" Properties: VpcId: !Ref VPC Tags: - Key: Name Value: !Sub "${AWS::StackName} - Public" PrivateRouteTable: Type: "AWS::EC2::RouteTable" Properties: VpcId: !Ref VPC Tags: - Key: Name Value: !Sub "${AWS::StackName} - Private" PublicRoute: Type: "AWS::EC2::Route" DependsOn: VPCGatewayAttachment Properties: RouteTableId: !Ref PublicRouteTable DestinationCidrBlock: 0.0.0.0/0 GatewayId: !Ref InternetGateway PublicSubnetRouteTableAssociation: Type: "AWS::EC2::SubnetRouteTableAssociation" Properties: SubnetId: !Ref PublicSubnet RouteTableId: !Ref PublicRouteTable PrivateSubnetRouteTableAssociation: Type: "AWS::EC2::SubnetRouteTableAssociation" Properties: SubnetId: !Ref PrivateSubnet RouteTableId: !Ref PrivateRouteTable NatGateway: Type: "AWS::EC2::NatGateway" Properties: AllocationId: !GetAtt - NatEIP - AllocationId SubnetId: !Ref PublicSubnet Tags: - Key: Name Value: !Sub "${AWS::StackName} - Studio-Q Quickstart" NatEIP: DependsOn: VPCGatewayAttachment Type: "AWS::EC2::EIP" Properties: Domain: vpc Tags: - Key: Name Value: !Sub "${AWS::StackName} - Studio-Q Quickstart" NatRoute: Type: "AWS::EC2::Route" Properties: RouteTableId: !Ref PrivateRouteTable DestinationCidrBlock: 0.0.0.0/0 NatGatewayId: !Ref NatGateway default: Type: "AWS::EC2::SecurityGroup" Properties: GroupDescription: default VpcId: !Ref VPC Outputs: VPCID: Value: !Ref VPC PrivateSubnetId: Value: !Ref PrivateSubnet PublicSubnetId: Value: !Ref PublicSubnet