0

I am making cloud9 by terraform according to the article here

However this code shows the error like this

│ Error: Your query returned no results. Please change your search criteria and try again. │ │ with module.cloud9.data.aws_ami.cloud9_ami, │ on ../../cloud9/main.tf line 1, in data "aws_ami" "cloud9_ami": │ 1: data "aws_ami" "cloud9_ami" {

I think this means there is not appropriate AMI.

How can I fix this ?

data "aws_ami" "cloud9_ami" {
  most_recent = true
  owners      = ["amazon"]
    
  filter {
    name   = "name"
    values = ["aws-cloud9-*-x86_64"] # Adjust pattern based on desired Cloud9 AMI
  }
    
  filter {
    name   = "virtualization-type"
    values = ["hvm"]
  }
}
    
resource "aws_cloud9_environment_ec2" "my_cloud9_environment" {
  name          = "my-cloud9-env"
  instance_type = "t2.micro"
  image_id      = data.aws_ami.cloud9_ami.id
  owner_arn     = "arn:aws:iam::123456789012:user/your-user"
  automatic_stop_time_minutes = 60
}

1 Answer 1

0

There are two things to consider:

  • region you want to deploy the instance into. The AMI names can differ in that case.
  • it seems Cloud9 image names start similar to Cloud9AmazonLinux2-2025-09-22T11-21.

So I would probably try something like:

data "aws_ami" "cloud9_ami" {
  most_recent = true
  owners      = ["amazon"]

  filter {
    name   = "name"
    values = ["Cloud9AmazonLinux2*"] # Adjust pattern based on desired Cloud9 AMI
  }

  filter {
    name   = "virtualization-type"
    values = ["hvm"]
  }

  filter {
    name   = "architecture"
    values = "x86_64" 
  }
}

A very important thing to note is that all the images will probably be deprecated very soon.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.