Hi there,
I am trying to build a EC2 in AWS with the help of the getting started guide [https://www.terraform.io/intro/getting-started/build.html].
The .tf file is like below
provider "aws" {
access_key = "<<>>"
secret_key = "<<>>"
region = "us-west-1"
}
resource "aws_instance" "example" {
ami = "ami-6f68cf0f"
instance_type = "t2.micro"
}
The ami instance 'ami-6f68cf0f' is available in AWS. Still I am getting this error
aws_instance.example: Error launching source instance: InvalidAMIID.NotFound: The image id '[ami-6f68cf0f]' does not exist
status code: 400
Your help is appreciates.
Hi @debabratp! Sorry things didn't work out here.
Are you sure that ami-6f68cf0f
is in the us-west-1 region, and accessible to the credentials you're using? The usual cause for this error is that the AMI is in a different region than you expect.
Hi @debabratp
Thanks for opening the issue here - @apparentlymart is correct - this AMI works in us-west-2 so you will need to find an appropriate AMI ID for us-west-1 for you to test
Thanks
Paul
Hi Guys
I am using "ami-14c5486b" for "us-east-1" all was working a day ago
Error: Error applying plan:
1 error occurred:
* aws_ami_from_instance.web_ami (destroy): 1 error occurred:
* aws_ami_from_instance.web_ami (deposed #0): 1 error occurred:
* aws_ami_from_instance.web_ami (deposed #0): InvalidAMIID.Unavailable: The image ID 'ami-0bae91fa59d2c34b3' is no longer available
status code: 400, request id: 094d1fa8-4033-4e07-9f2a-72a062c456e9
I am new to terraform and AWS integration, any help is appreciated.
Thanks in advance.
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
Hi @debabratp! Sorry things didn't work out here.
Are you sure that
ami-6f68cf0f
is in the us-west-1 region, and accessible to the credentials you're using? The usual cause for this error is that the AMI is in a different region than you expect.