We are going to create an AMI from an existing EC2 instance named "devops-ec2" Steps: 1. We need to find the existing EC2 instance by its name (tag) to get its ID. 2. Then, we will create an AMI from that instance ID. 3. We will name the AMI as "devo...
ami-for-existing-instance-using-terraform.hashnode.dev4 min read
Turning bugs into features since forever
Anik Sikder
Great step-by-step guide, Kunal! I like how you addressed the asynchronous nature of AMI creation and provided a practical Terraform + AWS CLI workaround using null_resource and local-exec to wait for the AMI to become available. This is often a pain point for many when automating AMI creation with Terraform. Also, the reminder to clean up resources to avoid unexpected charges is much appreciated. Thanks for sharing!