Create CloudFormation Stack
Welcome to CloudAffaire and this is Debjeet.
In the last blog post, we have discussed CloudFormation and its components.
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’.
Step 2: Click ‘Create Stack’.
Step 3: Select ‘Use a sample template’.
Provide LAMP Stack as ‘Sample templates’ and click ‘Next’.
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’.
Note: Select t2.micro as ‘InstanceType’ and select your keypair in ‘KeyName’.
Step 5: Leave ‘Configure stack options’ as it is and click ‘Next’.
Step 6: Review your stack configuration and click ‘Create 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.
Events: Stack creation details with timeline (used for troubleshooting if stack creation failed)
Resource: AWS resources created under this stack (in our case one EC2 instance, one Security Group)
Outputs: Values that are returned (In our case website url)
Parameters: Values passed to your template at runtime (In our case database and instance configuration details)
Template: The actual code for this stack in JSON format.
You can get the YAML code using below GitHub link.
Step 7: Cleanup.
Note: This will also delete the underlying resources for this stack.
You can get other useful CloudFormation template using below link
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