github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/aws/d/ami.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_ami"
     4  sidebar_current: "docs-aws-datasource-ami"
     5  description: |-
     6    Get information on a Amazon Machine Image (AMI).
     7  ---
     8  
     9  # aws\_ami
    10  
    11  Use this data source to get the ID of a registered AMI for use in other
    12  resources.
    13  
    14  ## Example Usage
    15  
    16  ```hcl
    17  data "aws_ami" "nat_ami" {
    18    most_recent      = true
    19    executable_users = ["self"]
    20  
    21    filter {
    22      name   = "owner-alias"
    23      values = ["amazon"]
    24    }
    25  
    26    filter {
    27      name   = "name"
    28      values = ["amzn-ami-vpc-nat*"]
    29    }
    30  
    31    name_regex = "^myami-\\d{3}"
    32    owners     = ["self"]
    33  }
    34  ```
    35  
    36  ## Argument Reference
    37  
    38  * `most_recent` - (Optional) If more than one result is returned, use the most
    39  recent AMI.
    40  
    41  * `executable_users` - (Optional) Limit search to users with *explicit* launch permission on
    42   the image. Valid items are the numeric account ID or `self`.
    43  
    44  * `filter` - (Optional) One or more name/value pairs to filter off of. There are
    45  several valid keys, for a full reference, check out
    46  [describe-images in the AWS CLI reference][1].
    47  
    48  * `owners` - (Optional) Limit search to specific AMI owners. Valid items are the numeric
    49  account ID, `amazon`, or `self`.
    50  
    51  * `name_regex` - (Optional) A regex string to apply to the AMI list returned
    52  by AWS. This allows more advanced filtering not supported from the AWS API. This
    53  filtering is done locally on what AWS returns, and could have a performance
    54  impact if the result is large. It is recommended to combine this with other
    55  options to narrow down the list AWS returns.
    56  
    57  ~> **NOTE:** At least one of `executable_users`, `filter`, `owners`, or
    58  `name_regex` must be specified.
    59  
    60  ~> **NOTE:** If more or less than a single match is returned by the search,
    61  Terraform will fail. Ensure that your search is specific enough to return
    62  a single AMI ID only, or use `most_recent` to choose the most recent one. If
    63  you want to match multiple AMIs, use the `aws_ami_ids` data source instead.
    64  
    65  ## Attributes Reference
    66  
    67  `id` is set to the ID of the found AMI. In addition, the following attributes
    68  are exported:
    69  
    70  ~> **NOTE:** Some values are not always set and may not be available for
    71  interpolation.
    72  
    73  * `architecture` - The OS architecture of the AMI (ie: `i386` or `x86_64`).
    74  * `block_device_mappings` - The block device mappings of the AMI.
    75    * `block_device_mappings.#.device_name` - The physical name of the device.
    76    * `block_device_mappings.#.ebs.delete_on_termination` - `true` if the EBS volume
    77      will be deleted on termination.
    78    * `block_device_mappings.#.ebs.encrypted` - `true` if the EBS volume
    79      is encrypted.
    80    * `block_device_mappings.#.ebs.iops` - `0` if the EBS volume is
    81      not a provisioned IOPS image, otherwise the supported IOPS count.
    82    * `block_device_mappings.#.ebs.snapshot_id` - The ID of the snapshot.
    83    * `block_device_mappings.#.ebs.volume_size` - The size of the volume, in GiB.
    84    * `block_device_mappings.#.ebs.volume_type` - The volume type.
    85    * `block_device_mappings.#.no_device` - Suppresses the specified device
    86      included in the block device mapping of the AMI.
    87    * `block_device_mappings.#.virtual_name` - The virtual device name (for
    88      instance stores).
    89  * `creation_date` - The date and time the image was created.
    90  * `description` - The description of the AMI that was provided during image
    91    creation.
    92  * `hypervisor` - The hypervisor type of the image.
    93  * `image_id` - The ID of the AMI. Should be the same as the resource `id`.
    94  * `image_location` - The location of the AMI.
    95  * `image_owner_alias` - The AWS account alias (for example, `amazon`, `self`) or
    96    the AWS account ID of the AMI owner.
    97  * `image_type` - The type of image.
    98  * `kernel_id` - The kernel associated with the image, if any. Only applicable
    99    for machine images.
   100  * `name` - The name of the AMI that was provided during image creation.
   101  * `owner_id` - The AWS account ID of the image owner.
   102  * `platform` - The value is Windows for `Windows` AMIs; otherwise blank.
   103  * `product_codes` - Any product codes associated with the AMI.
   104    * `product_codes.#.product_code_id` - The product code.
   105    * `product_codes.#.product_code_type` - The type of product code.
   106  * `public` - `true` if the image has public launch permissions.
   107  * `ramdisk_id` - The RAM disk associated with the image, if any. Only applicable
   108    for machine images.
   109  * `root_device_name` - The device name of the root device.
   110  * `root_device_type` - The type of root device (ie: `ebs` or `instance-store`).
   111  * `sriov_net_support` - Specifies whether enhanced networking is enabled.
   112  * `state` - The current state of the AMI. If the state is `available`, the image
   113    is successfully registered and can be used to launch an instance.
   114  * `state_reason` - Describes a state change. Fields are `UNSET` if not available.
   115    * `state_reason.code` - The reason code for the state change.
   116    * `state_reason.message` - The message for the state change.
   117  * `tags` - Any tags assigned to the image.
   118    * `tags.#.key` - The key name of the tag.
   119    * `tags.#.value` - The value of the tag.
   120  * `virtualization_type` - The type of virtualization of the AMI (ie: `hvm` or
   121    `paravirtual`).
   122  
   123  [1]: http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-images.html