FEATURES OPEN SOURCE ABOUT DOCS LOGIN REGISTER

aws_ami

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

Example Usage

data "aws_ami" "nat_ami" {
  most_recent = true
  executable_users = ["self"]
  filter {
    name = "owner-alias"
    values = ["amazon"]
  }
  filter {
    name = "name"
    values = ["amzn-ami-vpc-nat*"]
  }
  name_regex = "^myami-\\d{3}"
  owners = ["self"]
}

Argument Reference

~> NOTE: At least one of executable_users, filter, owners, or name_regex must be specified.

~> NOTE: If more or less than a single match is returned by the search, Terraform will fail. Ensure that your search is specific enough to return a single AMI ID only, or use most_recent to choose the most recent one.

Attributes Reference

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

~> NOTE: Some values are not always set and may not be available for interpolation.


See the source of this document at Terraform.io