--- AWSTemplateFormatVersion: '2010-09-09' Description: 'This template will launch the VPC Environment for .Net Modernization Workshop. You will be billed for the AWS resources used if you create a stack from this template.' Mappings: SubnetConfig: VPC: CIDR: 10.0.0.0/16 Public: CIDR: 10.0.0.0/24 Public2: CIDR: 10.0.1.0/24 Resources: VPC: Type: AWS::EC2::VPC Properties: EnableDnsSupport: 'true' EnableDnsHostnames: 'true' CidrBlock: Fn::FindInMap: - SubnetConfig - VPC - CIDR Tags: - Key: Name Value: "Demo VPC" - Key: Application Value: Ref: AWS::StackName - Key: Network Value: Public PublicSubnet1: Type: AWS::EC2::Subnet Properties: VpcId: Ref: VPC AvailabilityZone: !Select [ 0, !GetAZs '' ] CidrBlock: Fn::FindInMap: - SubnetConfig - Public - CIDR Tags: - Key: Application Value: Ref: AWS::StackName - Key: Network Value: Public PublicSubnet2: Type: AWS::EC2::Subnet Properties: VpcId: Ref: VPC AvailabilityZone: !Select [ 1, !GetAZs '' ] CidrBlock: Fn::FindInMap: - SubnetConfig - Public2 - CIDR Tags: - Key: Application Value: Ref: AWS::StackName - Key: Network Value: Public InternetGateway: Type: AWS::EC2::InternetGateway Properties: Tags: - Key: Application Value: Ref: AWS::StackName - Key: Network Value: Public GatewayToInternet: Type: AWS::EC2::VPCGatewayAttachment Properties: VpcId: Ref: VPC InternetGatewayId: Ref: InternetGateway PublicRouteTable: Type: AWS::EC2::RouteTable Properties: VpcId: Ref: VPC Tags: - Key: Application Value: Ref: AWS::StackName - Key: Network Value: Public PublicRoute: Type: AWS::EC2::Route DependsOn: GatewayToInternet Properties: RouteTableId: Ref: PublicRouteTable DestinationCidrBlock: 0.0.0.0/0 GatewayId: Ref: InternetGateway PublicSubnet1RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Properties: SubnetId: Ref: PublicSubnet1 RouteTableId: Ref: PublicRouteTable PublicSubnet2RouteTableAssociation: Type: AWS::EC2::SubnetRouteTableAssociation Properties: SubnetId: Ref: PublicSubnet2 RouteTableId: Ref: PublicRouteTable PublicNetworkAcl: Type: AWS::EC2::NetworkAcl Properties: VpcId: Ref: VPC Tags: - Key: Application Value: Ref: AWS::StackName - Key: Network Value: Public InboundPublicNetworkAclEntry: Type: AWS::EC2::NetworkAclEntry Properties: NetworkAclId: Ref: PublicNetworkAcl RuleNumber: '100' Protocol: -1 RuleAction: allow Egress: 'false' CidrBlock: 0.0.0.0/0 OutboundPublicNetworkAclEntry: Type: AWS::EC2::NetworkAclEntry Properties: NetworkAclId: Ref: PublicNetworkAcl RuleNumber: '100' Protocol: -1 RuleAction: allow Egress: 'true' CidrBlock: 0.0.0.0/0 PublicSubnet1NetworkAclAssociation: Type: AWS::EC2::SubnetNetworkAclAssociation Properties: SubnetId: Ref: PublicSubnet1 NetworkAclId: Ref: PublicNetworkAcl PublicSubnet2NetworkAclAssociation: Type: AWS::EC2::SubnetNetworkAclAssociation Properties: SubnetId: Ref: PublicSubnet2 NetworkAclId: Ref: PublicNetworkAcl Outputs: VPCId: Description: VPCId of the newly created VPC Value: Ref: VPC Export: Name: ModernizationVPC:VPCId PublicSubnet1: Description: SubnetId of the public subnet 1 Value: Ref: PublicSubnet1 Export: Name: ModernizationVPC:PublicSubnet1 PublicSubnet2: Description: SubnetId of the public subnet 2 Value: Ref: PublicSubnet2 Export: Name: ModernizationVPC:PublicSubnet2 VPCCIDR: Description: VPC CIDR CidrBlock Value: Fn::FindInMap: - SubnetConfig - VPC - CIDR Export: Name: ModernizationVPC:VPCCIDR