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