github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/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 ``` 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. 63 64 ## Attributes Reference 65 66 `id` is set to the ID of the found AMI. In addition, the following attributes 67 are exported: 68 69 ~> **NOTE:** Some values are not always set and may not be available for 70 interpolation. 71 72 * `architecture` - The OS architecture of the AMI (ie: `i386` or `x86_64`). 73 * `block_device_mappings` - The block device mappings of the AMI. 74 * `block_device_mappings.#.device_name` - The physical name of the device. 75 * `block_device_mappings.#.ebs.delete_on_termination` - `true` if the EBS volume 76 will be deleted on termination. 77 * `block_device_mappings.#.ebs.encrypted` - `true` if the EBS volume 78 is encrypted. 79 * `block_device_mappings.#.ebs.iops` - `0` if the EBS volume is 80 not a provisioned IOPS image, otherwise the supported IOPS count. 81 * `block_device_mappings.#.ebs.snapshot_id` - The ID of the snapshot. 82 * `block_device_mappings.#.ebs.volume_size` - The size of the volume, in GiB. 83 * `block_device_mappings.#.ebs.volume_type` - The volume type. 84 * `block_device_mappings.#.no_device` - Suppresses the specified device 85 included in the block device mapping of the AMI. 86 * `block_device_mappings.#.virtual_name` - The virtual device name (for 87 instance stores). 88 * `creation_date` - The date and time the image was created. 89 * `description` - The description of the AMI that was provided during image 90 creation. 91 * `hypervisor` - The hypervisor type of the image. 92 * `image_id` - The ID of the AMI. Should be the same as the resource `id`. 93 * `image_location` - The location of the AMI. 94 * `image_owner_alias` - The AWS account alias (for example, `amazon`, `self`) or 95 the AWS account ID of the AMI owner. 96 * `image_type` - The type of image. 97 * `kernel_id` - The kernel associated with the image, if any. Only applicable 98 for machine images. 99 * `name` - The name of the AMI that was provided during image creation. 100 * `owner_id` - The AWS account ID of the image owner. 101 * `platform` - The value is Windows for `Windows` AMIs; otherwise blank. 102 * `product_codes` - Any product codes associated with the AMI. 103 * `product_codes.#.product_code_id` - The product code. 104 * `product_codes.#.product_code_type` - The type of product code. 105 * `public` - `true` if the image has public launch permissions. 106 * `ramdisk_id` - The RAM disk associated with the image, if any. Only applicable 107 for machine images. 108 * `root_device_name` - The device name of the root device. 109 * `root_device_type` - The type of root device (ie: `ebs` or `instance-store`). 110 * `sriov_net_support` - Specifies whether enhanced networking is enabled. 111 * `state` - The current state of the AMI. If the state is `available`, the image 112 is successfully registered and can be used to launch an instance. 113 * `state_reason` - Describes a state change. Fields are `UNSET` if not available. 114 * `state_reason.code` - The reason code for the state change. 115 * `state_reason.message` - The message for the state change. 116 * `tags` - Any tags assigned to the image. 117 * `tags.#.key` - The key name of the tag. 118 * `tags.#.value` - The value of the tag. 119 * `virtualization_type` - The type of virtualization of the AMI (ie: `hvm` or 120 `paravirtual`). 121 122 [1]: http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-images.html