Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Terraform: Error launching source instance: InvalidAMIID.Malformed

Going through terraform tutorial I stumbled upon this error.

Error: Error launching source instance: InvalidAMIID.NotFound: The image id '[ami-830c94e3]' does not exist
    status code: 400, request id: 4c3e0252-c3a5-471e-8b57-3f6e349628af

This is my code. The only change that I did was was region change from us-west-2 to eu-central-1

provider "aws" {
  profile = "default"
  region = "eu-central-1"
}

resource "aws_instance" "example" {
  ami = "ami-830c94e3"
  instance_type = "t2.micro"
}
like image 422
Lukasz Dynowski Avatar asked Aug 28 '20 12:08

Lukasz Dynowski


1 Answers

It was simple. Apparently, AMI for Amazon Images of each region is different. I had to copy the AMI of the image that was present in my region. For example ami-07dfba995513840b5 is the id for Red Hat Enterprise Linux 8 (HVM), SSD Volume Type in eu-central-1 region. Go to AWS console, click EC2 from all services list, next click launch instance and find the AMI of an image of your interest.

like image 155
Lukasz Dynowski Avatar answered Sep 16 '22 11:09

Lukasz Dynowski