github.com/pbthorste/terraform@v0.8.6-0.20170127005045-deb56bd93da2/website/source/docs/providers/aws/d/instance.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_instance"
     4  sidebar_current: "docs-aws-datasource-instance"
     5  description: |-
     6    Get information on a Amazon EC2 Instance.
     7  ---
     8  
     9  # aws\_instance
    10  
    11  Use this data source to get the ID of an EC2 Instance for use in other
    12  resources.
    13  
    14  ## Example Usage
    15  
    16  ```
    17  data "aws_instance" "foo" {
    18    instance_id = "i-instanceid"
    19    filter {
    20      name = "image-id"
    21      values = ["ami-xxxxxxxx"]
    22    }
    23    filter {
    24      name = "tag:Name"
    25      values = ["instance-name-tag"]
    26    }
    27  }
    28  ```
    29  
    30  ## Argument Reference
    31  
    32  * `instance_id` - (Optional) Specify the exact Instance ID to populate the data source with.
    33  
    34  * `instance_tags` - (Optional) A mapping of tags, each pair of which must 
    35  exactly match a pair on the desired Instance.
    36  
    37  * `filter` - (Optional) One or more name/value pairs to filter off of. There are
    38  several valid keys, for a full reference, check out
    39  [describe-instances in the AWS CLI reference][1].
    40  
    41  ~> **NOTE:** At least one of `filter`, `instance_tags`, or `instance_id` must be specified.
    42  
    43  ~> **NOTE:** If more or less than a single match is returned by the search,
    44  Terraform will fail. Ensure that your search is specific enough to return
    45  a single Instance ID only.
    46  
    47  ## Attributes Reference
    48  
    49  `id` is set to the ID of the found Instance. In addition, the following attributes
    50  are exported:
    51  
    52  ~> **NOTE:** Some values are not always set and may not be available for
    53  interpolation.
    54  
    55  * `associate_public_ip_address` - Whether or not the instance is associated with a public ip address or not (Boolean).
    56  * `availability_zone` - The availability zone of the instance.
    57  * `ebs_block_device` - The EBS block device mappings of the instance.
    58    * `delete_on_termination` - If the EBS volume will be deleted on termination.
    59    * `device_name` - The physical name of the device.
    60    * `encrypted` - If the EBS volume is encrypted.
    61    * `iops` - `0` If the EBS volume is not a provisioned IOPS image, otherwise the supported IOPS count.
    62    * `snapshot_id` - The ID of the snapshot.
    63    * `volume_size` - The size of the volume, in GiB.
    64    * `volume_type` - The volume type.
    65  * `ebs_optimized` - Whether the instance is ebs optimized or not (Boolean).
    66  * `ephemeral_block_device` - The ephemeral block device mappings of the instance.
    67    * `device_name` - The physical name of the device.
    68    * `no_device` - Whether the specified device included in the device mapping was suppressed or not (Boolean).
    69    * `virtual_name` - The virtual device name 
    70  * `iam_instance_profile` - The instance profile associated with the instance. Specified as an ARN.
    71  * `instance_type` - The type of the instance.
    72  * `key_name` - The key name of the instance.
    73  * `monitoring` - Whether detailed monitoring is enabled or disabled for the instance (Boolean).
    74  * `network_interface_id` - The ID of the network interface that was created with the instance.
    75  * `placement_group` - The placement group of the instance.
    76  * `private_dns` - The private DNS name assigned to the instance. Can only be
    77    used inside the Amazon EC2, and only available if you've enabled DNS hostnames 
    78    for your VPC.
    79  * `private_ip` - The private IP address assigned to the instance.
    80  * `public_dns` - The public DNS name assigned to the instance. For EC2-VPC, this 
    81    is only available if you've enabled DNS hostnames for your VPC.
    82  * `public_ip` - The public IP address assigned to the instance, if applicable. **NOTE**: If you are using an [`aws_eip`](/docs/providers/aws/r/eip.html) with your instance, you should refer to the EIP's address directly and not use `public_ip`, as this field will change after the EIP is attached.
    83  * `root_block_device` - The root block device mappings of the instance
    84    * `delete_on_termination` - If the root block device will be deleted on termination.
    85    * `iops` - `0` If the volume is not a provisioned IOPS image, otherwise the supported IOPS count.
    86    * `volume_size` - The size of the volume, in GiB.
    87    * `volume_type` - The type of the volume.
    88  * `security_groups` - The associated security groups.
    89  * `source_dest_check` - Whether the network interface performs source/destination checking (Boolean).
    90  * `subnet_id` - The VPC subnet ID.
    91  * `user_data` - The User Data supplied to the instance. 
    92  * `tags` - A mapping of tags assigned to the instance.
    93  * `tenancy` - The tenancy of the instance (dedicated | default | host ).
    94  * `vpc_security_group_ids` - The associated security groups in non-default VPC.
    95  
    96  [1]: http://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html