Create CloudFormation Stack

Create CloudFormation Stack

Create CloudFormation Stack

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed CloudFormation and its components.

https://cloudaffaire.com/cloudformation-introduction/

In this blog post, we are going to create our 1st CloudFormation Stack in AWS console (new redesigned CloudFormation console) using sample LAMP with local MySQL database template.

Create CloudFormation Stack:

Step 1: Login to AWS console and navigate to ‘CloudFormation’.

Create CloudFormation Stack

Step 2: Click ‘Create Stack’.

Create CloudFormation Stack

Step 3: Select ‘Use a sample template’.

Create CloudFormation Stack

Provide LAMP Stack as ‘Sample templates’ and click ‘Next’.

Create CloudFormation Stack

Note: To reduce the cost, select the LAMP Stack with a local MySQL database and not the highly available one.

Step 4: Provide name, parameters for your LAMP stack and click ‘Next’.

Create CloudFormation Stack

Create CloudFormation Stack

Note: Select t2.micro as ‘InstanceType’ and select your keypair in ‘KeyName’.

Step 5: Leave ‘Configure stack options’ as it is and click ‘Next’.

Create CloudFormation Stack

Step 6: Review your stack configuration and click ‘Create stack’.

Create CloudFormation Stack

Note: It will take some time to complete the stack creation. You can monitor the progress in the ‘Events’ section.

Our LAMP stack successfully created.

Create CloudFormation Stack

Events: Stack creation details with the timeline (used for troubleshooting if stack creation failed)

Create CloudFormation Stack

Resource: AWS resources created under this stack (in our case one EC2 instance, one Security Group)

Create CloudFormation Stack

Outputs: Values that are returned (In our case website url)

Create CloudFormation Stack

Create CloudFormation Stack

Parameters: Values passed to your template at runtime (In our case database and instance configuration details)

Create CloudFormation Stack

Template: The actual code for this stack in JSON format.

Create CloudFormation Stack

You can get the YAML code using below GitHub link.

https://github.com/CloudAffaire/CloudFormation

Step 7: Cleanup.

Create CloudFormation Stack

Note: This will also delete the underlying resources for this stack.

You can get other useful CloudFormation template using below link

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/sample-templates-services-us-west-2.html

Note: Do not create any stack using online sample template without proper understanding, it may have a significant cost associated with it.

Hope you have enjoyed this article. In the next blog post, we will create a CloudFormation template of our own using YAML.

To get more details on CloudFormation, please refer below AWS documentation

https://docs.aws.amazon.com/cloudformation/index.html

 

Leave a Reply

Close Menu