This lab illustrates best practices for reliability as described in the AWS Well-Architected Reliability pillar.
How do you implement change?
When this lab is completed, you will have deployed and edited a CloudFormation template. Using this template you will deploy a VPC, an S3 bucket and an EC2 instance running a simple web server.
If you are attending an in-person workshop and were provided with an AWS account by the instructor:
If you are using your own AWS account:
You will begin by deploying a CloudFormation stack that creates a simple VPC as shown in this diagram:
The template is written in a format called YAML , which is commonly used for configuration files. The format of the file is important, especially indents and hyphens. CloudFormation templates can also be written in JSON.
Look through the file. You will notice several sections:
The Parameters section is used to prompt for inputs that can be used elsewhere in the template. The template is asking for several inputs, but also provides default values for each one. Look through these and start to reason about what each one is.
The Conditions section is where you can setup if/then-like control of what happens during template deployment. It defines the circumstances under which entities are created or configured.
The Resources section is the “heart” of the template. It is where you define the infrastructure to be deployed. Look at the first resource defined.
SimpleVPC. This logical ID is how we refer to the VPC resource within the CloudFormation template.
Typewhich tells CloudFormation which type of resource to create
Propertiesthat define the values used to create the VPC
The Outputs section is used to display selective information about resources in the stack.
The Metadata section here is used to group and order how the CloudFormation parameters are displayed when you deploy the template using the AWS Console
|When editing CloudFormation templates written in YAML, be extra cautious that you maintain the correct number of spaces for each indentation|
|Indents are always in increments of two spaces|
You will now use this template to launch a CloudFormation stack that will deploy AWS resources in your AWS account.
Go to the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation and click Create Stack > With new resources
Leave Prepare template setting as-is
For Stack name use CloudFormationLab
Look over the Parameters and their default values.
For Configure stack options we recommend configuring tags, which are key-value pairs, that can help you identify your stacks and the resources they create. For example, enter Owner in the left column which is the key, and your email address in the right column which is the value. We will not use additional permissions or advanced options so click Next. For more information, see Setting AWS CloudFormation Stack Options .
This will take you to the CloudFormation stack status page, showing the stack creation in progress.
When it shows status CREATE_COMPLETE, then you are finished with this step.
Deployment will take approximately 30 seconds to deploy.