---
title: "Discussion on \"Create AMI for Existing Instance Using Terraform\" | Hashnode"
description: "Discussion on \"Create AMI for Existing Instance Using Terraform\". We are going to create an AMI from an existing EC2 instance named \"devops-ec2\"\nSteps:\n1. We need to find the existing EC2 instance by its name (tag) to get its ID.\n2. Then, we will create an AMI from that instance ID.\n3. We will name the AMI as \"devo..."
url: "https://hashnode.com/posts/create-ami-for-existing-instance-using-terraform/6898a996ee50915fabea4839"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Create AMI for Existing Instance Using Terraform](https://ami-for-existing-instance-using-terraform.hashnode.dev/create-ami-for-existing-instance-using-terraform?utm_source=hashnode&utm_medium=feed)

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...

Aug 10, 2025 · 4 min read · ami-for-existing-instance-using-terraform.hashnode.dev  
Read the article

-   [#devops](https://hashnode.com/tag/devops)
-   [#devops-articles](https://hashnode.com/tag/devops-articles)
-   [#terraform](https://hashnode.com/tag/terraform)
-   [#terraform-aws-infrastructureascode-provisioning-automation-cloudcomputing](https://hashnode.com/tag/terraform-aws-infrastructureascode-provisioning-automation-cloudcomputing)
-   [#terraform-cloud](https://hashnode.com/tag/terraform-cloud)
-   [#aws](https://hashnode.com/tag/aws)
-   [#aws-certified-solutions-architect-associate](https://hashnode.com/tag/aws-certified-solutions-architect-associate)
-   [#ami](https://hashnode.com/tag/ami)
-   [#ec2-instance](https://hashnode.com/tag/ec2-instance)

## Written by

[Kunal Kumar Singh](https://hashnode.com/@Kunalsingh2908)

@Kunalsingh2908 · India

  
[View profile](https://hashnode.com/@Kunalsingh2908)

DevOps Engineer, Automating Infrastructure to save time for future Generation :)

I am a DevOps Engineer working in MNC. Where I automate Infrastructure using various DevOps tools and AWS Cloud.

## Responses 1

Markdown supported · ⌘↵ to post

[Anik Sikder](https://hashnode.com/@anik169)

[Aug 10, 2025](https://hashnode.com/posts/create-ami-for-existing-instance-using-terraform/6898a996ee50915fabea4839/comment/6898c1336dc943cb058d7047)

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!

[Kunal Kumar Singh](https://hashnode.com/@Kunalsingh2908)

[Aug 11, 2025](https://hashnode.com/posts/create-ami-for-existing-instance-using-terraform/6898a996ee50915fabea4839/comment/6898c1336dc943cb058d7047#reply-6899d9f3ecc2a6cfdef3d46c)

Thanks for appreciating the work :)
