# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 Resources: VPC: Type: AWS::EC2::VPC Properties: CidrBlock: 192.168.0.0/16 EnableDnsHostnames: true EnableDnsSupport: true IGW: Type: AWS::EC2::InternetGateway IGWAttachment: Type: AWS::EC2::VPCGatewayAttachment Properties: InternetGatewayId: !Ref IGW VpcId: !Ref VPC SubnetAPublic: Type: AWS::EC2::Subnet Properties: AvailabilityZone: Fn::Select: - 0 - Fn::GetAZs: !Ref AWS::Region CidrBlock: 192.168.0.0/24 VpcId: !Ref VPC SubnetBPublic: Type: AWS::EC2::Subnet Properties: AvailabilityZone: Fn::Select: - 1 - Fn::GetAZs: !Ref AWS::Region CidrBlock: 192.168.2.0/24 VpcId: !Ref VPC PublicRouteTable: Type: AWS::EC2::RouteTable Properties: VpcId: !Ref VPC RouteToInternet: Type: AWS::EC2::Route Properties: DestinationCidrBlock: 0.0.0.0/0 GatewayId: !Ref IGW RouteTableId: !Ref PublicRouteTable RouteToInternetAssociationSubnetA: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: !Ref PublicRouteTable SubnetId: !Ref SubnetAPublic RouteToInternetAssociationSubnetB: Type: AWS::EC2::SubnetRouteTableAssociation Properties: RouteTableId: !Ref PublicRouteTable SubnetId: !Ref SubnetBPublic Outputs: VpcId: Value: !Ref VPC PublicSubnetAId: Value: !Ref SubnetAPublic PublicSubnetBId: Value: !Ref SubnetBPublic