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