Data Source: aws_instance

Use this data source to get the ID of an Amazon EC2 Instance for use in other resources.

Example Usage

data "aws_instance" "foo" {
  instance_id = "i-instanceid"

  filter {
    name   = "image-id"
    values = ["ami-xxxxxxxx"]
  }

  filter {
    name   = "tag:Name"
    values = ["instance-name-tag"]
  }
}

Argument Reference

Attribute Reference

id is set to the ID of the found Instance. In addition, the following attributes are exported:

Timeouts

Configuration options: