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