Support Documents
×
No data found.


Update CloudFormation stack by creating Change set

Case Study

  1. A company is having its application on t2.micro instance. Company is expecting high traffic, so it wants Cloud System Administrator to increase the capacity of server to handle the load.
  2. System Administrator also has a requirement to disable the SSH access and provide only HTTP access to the server.
  3. How does Cloud SysAdmin handle it?

AWS Exam Lab Tasks

  1. Create Cloudformation Template with below details
    • EC2 Instance - t2.micro
    • SSH Port open.
  2. Upload Cloudformation Template to S3 bucket.
  3. Create a CloudFormation Stack using Template from S3.
  4. Provision an EC2 Instances.
  5. Update the Cloudformation Stack to :
    • Increase server capacity from t2.micro to t2.medium
    • Remove SSH Port access
    • Provide HTTP Port Access
  6. Execute the Changes and chek if the server capacity has been increased.

What AWS wants you to learn from this lab

  • Infrastructure as a Code

 

Introduction to AWS Services used in Lab

AWS CloudFormation

  1. CloudFormation is a service provided by AWS for designing our own infrastructure using code i.e infrastructure as code.

  2. Currently, CloudFormation supports two languages JSON and YAML. You can write your code with one of the languages.

  3. CloudFormation comes with great features being able to update your infrastructure whenever you want and also having the ability to delete the stack in case you don’t need it.

  4. A fascinating feature of cloudFormation is that it saves more time in building infrastructure and helps in focusing on the development.

  5. It is also possible to replicate our infrastructure in a short amount of time.

  6. It eliminates human error and works according to the code you have written. It consists of two main components, Stack and Templates.

CloudFormation Template

  1. It consists of various sections like 

  • AWS Template Format Version

  • Description

  • Metadata

  • Parameters

  • Mappings

  • Conditions

  • Resources (Required Field)

  • Outputs

  1. It is not mandatory that the template requires all the above-mentioned sections. By using only the Resources section, we will be able to create a template.    

  2. The resources section plays an important role in the template creation.

  3. For example, to create an EC2 instance, a template shall consist of various parameters such as key name, image id, instance type.

  4. It is also possible to create two resources in the same template and refer to one from another i.e. attaching an elastic IP with an EC2 instance.

CloudFormation Stack

  1. A stack consists of a collection of resources. 

  2. In other words, the stack consists of one or more templates.

  3. The advantage of the stack is that it is easy to create, delete or update the collection of resources.

  4. The advanced stacks have a nested stack which holds a collection of stacks.

 

Lab Details

  1. This lab walks you through the steps to understand a sample CloudFormation template and update the CloudFormation stack as per the requirements.

  2. You will practice using Amazon Machine Images to launch Amazon EC2 Instances and change the instance type as part of the update, replace port 22 with port 80 and finally display the private IP of the EC2 instance as output. All these updates will be created as Change set.

  3. Duration: 90 minutes

  4. AWS Region: US East (N. Virginia) us-east-1

Architecture Diagram

Task Details

  1. Launching Lab Environment

  2. Copy the S3 Object URL of the Sample template to create CloudFormation stack

  3. Create a CloudFormation stack using a template present in an S3 bucket.

  4. Create a Change set for the CloudFormation stack

  5. Check the updates and changes applied

  6. Validation of the lab.

  7. Deleting AWS Resources.