How to Get the Latest OS AMI Id in AWS using Terraform

When we need to deploy an EC2 instance in AWS (Amazon Web Services), we will need to get the AMI (Amazon Machine Image) ID of the image based on the AWS region and operating system version.

To achieve this task, we can use the data source “aws_ami” in Terraform.

Get Latest AMI of Amazon Linux

--

--

--

Certified AWS, Azure & GCP Architect | HashiCorp Ambassador | Terraform SME | KopiCloud Founder | Entrepreneur & Innovator | Book Author | Husband & Dad of ✌

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Code Smell 73 — Exceptions for Expected Cases

Git is not GITHUB

Upgrading Helm v2 to Helm v3 on Windows

Matrix Multiplication:

An Introduction to Obsidian: Backup

CKAD Preparation and Tips

How to Speed Up Product Launch with Scoping Session

Validation with Metaprogramming Decorators in Python — Advanced Python

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Guillermo Musumeci

Guillermo Musumeci

Certified AWS, Azure & GCP Architect | HashiCorp Ambassador | Terraform SME | KopiCloud Founder | Entrepreneur & Innovator | Book Author | Husband & Dad of ✌

More from Medium

How to Deploy an Ubuntu Linux EC2 Instance in AWS using Terraform

Tips on using version constraint in Hashicorp Terraform

Learn SLB (load balancing) in Alibaba Cloud — The console

Create AWS Infrastructure Using Terraform