Drawing inspiration from Drew Firment's challenge to play in the cloud sandbox. I had decided to begin my AWS builder journey through the project- "Use CloudFormation to Launch an EC2 Web Server".
This was a real fun activity with loads of learnings. Quite a CloudFormation novice that I am, I did have a fair share of hiccups that I have mentioned in the Troubleshooting section. For the exercise I have followed the online tutorial given in the AWS documentation walkthrough https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/working-with-templates-cfn-designer-walkthrough-createbasicwebserver.html#working-with-templates-cfn-designer-walkthrough-createbasicwebserver-resourceproperties .
It was really satisfying seeing the above congratulatory message post the successful launch of the web server. I could really experience the power of cloud!!!
Troubleshooting guide:
1.While uploading the completed CloudFormation Template to create a stack. I faced the error- "Failed to retrieve external values". This was due to incorrect placement of the access key name while declaring the parameters for the WebServerInstance
EC2InstanceKey: <--- Mention the actual key name created in the AWS region you are using
Description: Name of an EC2 KeyPair to enable SSH access to the instance.
Type: 'AWS::EC2::KeyPair::KeyName'
ConstraintDescription: must be the name of an existing EC2 KeyPair.
Subsequently, while referring this key in the WebServer Instance use the exact name as given below
KeyName: !Ref EC2InstanceKey
Public Route Table resource creation failed while creating the stack. Here, the error shown in the Events section of CloudFormation was self explanatory. The VPCId had been missed in the properties of the table in the template.
AMI ID: Mention the appropriate AMI ID as per the latest architecture. The script present in the walkthrough tutorial has older versions of AMI,as a result the EC2 Instance Connect was not working and neither could I connect to the EC2 Public IPV4 address.
Rather than opting for the static declaration of AMI ID and instance types as in the walkthrough, one can opt for passing dynamically with the help of SSM Parameter store.
4.Explicitly specify the Subnet-Route Table association using the AWS::EC2::SubnetRouteTableAssociation type. I had not used as it was not mentioned in the walkthrough due to which I had to map the internet gateway to the route table post the stack creation.This led to the EC2 instance not being connected to the internet and same behaviour post the addition too.
My sincere thanks to Drew. Moving to the next challenge. Onwards and Upwards!!! #AWS
The CloudFormation template is present at the below GitHub link:
https://github.com/neetu-mallan/CloudFormationTemplate/tree/master
Top comments (0)