Creating VPC Stack

At this point you have everything you need to build an AWS VPC as a nested stack, spanned across multiple Availability zones as shown in the image below.


Add QuickStart VPC as a nested stack

Open templates/master.template.yaml in an editor to inspect the contents of the file. Right now the Resources section is empty.

You will add a resource of Type ‘AWS::CloudFormation::Stack’ to create a nested cloudformation stack.

Close templates/master.template.yaml file and run the following command to add VPC Stack resource.

curl -s >>templates/master.template.yaml

Add and commit your changes.

git add .

git commit -a -m 'Add QuickStart VPC as a nested stack'

Inspect VPC Stack Resource

Open templates/master.template.yaml in an editor and your Resources sections should look as shown below.

        Type: 'AWS::CloudFormation::Stack'
          TemplateURL: !Sub >-
            AvailabilityZones: !Join
              - ','
              - !Ref AvailabilityZones
            KeyPairName: !Ref KeyPairName
            NumberOfAZs: '2'
            PrivateSubnet1ACIDR: !Ref PrivateSubnet1CIDR
            PrivateSubnet2ACIDR: !Ref PrivateSubnet2CIDR
            PublicSubnet1CIDR: !Ref PublicSubnet1CIDR
            PublicSubnet2CIDR: !Ref PublicSubnet2CIDR
            VPCCIDR: !Ref VPCCIDR

Congratulations! You have successfully added an AWS VPC to your Quick Start.