AWS Cloud formation using Linux AMI and custom bootstrap script
You can also create EC2 instances with custom boot strap script using cloud formation template.
Create an AMI from an EC2 Instance
Copy AMI ID and modify that in the cloud formation template, save this file as YAML extension, you need to modify the ImageId with the image ID from your AMI screen’s AMI ID.
Since my EC2 Instance in AMI does not have any Boot strap script, so to boot strap, i’ve added my bootstrap script under UserData section of Cloud formation template.
To upload CloudFormation template, follow below steps:
Using above steps it will create an EC2 instance with user data (bootstrap script) in it. Once it has fully loaded, get Public IPv4 DNS from EC2 Instance summary page and access it in browser, you should see below screen.
This is very useful in case you do not have a custom bootstrap script in your AMI and you want to bootstrap using Cloud formation template.