CloudFormation continued
-
Adding ec2 instance to the template
-
Refer Here for the changeset containing ec2 instance in web1 and app1 subnets
-
Todo:
- The VPC Which we have created doesnot have internet access, we need to create it
- EC2 instance in the app subnet doesn’t require public ip address and ec2 instance in the web subnet should have a public ip address
- We need to handle the ami id so that depending on the region where the template is executed ami id is automatically picked.
-
Solution for todo’s
- Internet access to the VPC
- For this we need to create an internet gateway and attach it to vpc
- We need to create a public route table and private route table
- For public ip address we need to fill the extrasections i.e. Network Interfaces in the ec2 resource
- For handling automatic picking up of ami id based on region we need to explore the mappings section in cloud formation
- Internet access to the VPC
-
Sample Templates
- By Service Refer Here
- Template Snippets Refer Here
- By region Refer Here
- By Application frameworks Refer Here
