BASIC OF CLOUDFORMATION UNDER AWS

Cloudformation if we define is a automation product available in AWS as a service. It is an IAC (Infrastructure as code) using cloud formation we can create infrastructure using YAML or JSON file and we can use this template to create,update delete our infrastructure

Benefits of implementing Cloudformation

  • We can test our infrastructure first on test environment and then can move it to Production.
  • The Cloudformation template can be reused.
  • Across the business these template can be used as library and can be used across teams.
  • Template can be used for temporary periods so team can use it to create , update and delete if required for temporary or short period.
1

BASIC OF TEMPLATE FILE

It is a JSON or YAML format file which defines logic resources which needs to be created , updated or deleted when integrated with the stack.

2

Under the file Resources is mandatory tag.

Description :- gives free text description for templates

Parameter :- can ask for input from user like what amount CPU is requres for a blcok.

Output :- What output user should receive like if it’s a wordpress tempalte user should get URL of wordpress site after running the template.

Resources :-

WHAT IS STACK

Stack is a container which contains logical resources which are defined under the template files and uploaded over STACK.Stack create,update or deletes physical resources for each o the logical resources defined under the template file.

CREATING STACK BY UPLOAD TEMPLATE

Open your AWS Cloud console and navigate to cloudFormation service

3

On next window click on a create stack (With new resources)

4

Next windows we will get multiple option of choosing the template like upload a existing template , use a sample template , create template in designer under this example we are upload an existing template so we will choose the option Template is ready and then under specify template window we will choose the option upload the template file.

5

At the third step you can choose the option of uploading the template template can be saved on local drive or on github or over S3.

For this example template can be found at
https://github.com/devops81/CloudFormation/tree/master/lab_files/01_aws_sa_fundamentals/getting_started_with_cfn – You don’t have permissions to view Try another account

Once template has been uploaded it will come something like below :-

7

After this click on NEXT under this screen we require to provide a STACK NAME after providing the stack name click on Next again.

8

Under the next screen you can choose option for IAM role for permissions on how cloudFormation can create , modify , delete resources in the stack if not required you can keep as it is once done with configuration on this screen click on Next it will take us to the Review stack window if anything needs to be updated we can lick on respective Edit button otherwise we can just hit the create stack button.

9

Once we click on create stack button it will take us to actual window where we can see stack creation progress.
10
We can see the progress of stack creation by click on the refresh option provided under the Events tab. Once the stack is created we can see the status as completed.

11

Next if we go to the Resources tab we can see the Physical resources for example here (S3 Bucket) has been created as per the logical resources provided under the template file.
Resource can by anything defined under template file :- (VPC , EC2 INSTANCE , S3)

12

So we have seen how to create a template , upload a template over stack and then how that stack uses the template to create Physical resource.

Leave a Reply