Data Source: aws_ami

Use this data source to get the ID of a registered AMI for use in other resources.

Example Usage

data "aws_ami" "example" {
  executable_users = ["self"]
  most_recent      = true
  name_regex       = "^myami-\\d{3}"
  owners           = ["self"]

  filter {
    name   = "name"
    values = ["myami-*"]
  }

  filter {
    name   = "root-device-type"
    values = ["ebs"]
  }

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

Argument Reference

Attribute Reference

id is set to the ID of the found AMI. In addition, the following attributes are exported:

Timeouts

Configuration options: