Skip to content

Data Source: awsEc2Host

Use this data source to get information about an EC2 Dedicated Host.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsEc2HostTest = new aws.ec2Host.Ec2Host(this, "test", {
  availabilityZone: "us-west-2a",
  instanceType: "c5.18xlarge",
});
const dataAwsEc2HostTest = new aws.dataAwsEc2Host.DataAwsEc2Host(
  this,
  "test_1",
  {
    hostId: awsEc2HostTest.id,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAwsEc2HostTest.overrideLogicalId("test");

Filter Example

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.dataAwsEc2Host.DataAwsEc2Host(this, "test", {
  filter: [
    {
      name: "instance-type",
      values: ["c5.18xlarge"],
    },
  ],
});

Argument Reference

The arguments of this data source act as filters for querying the available EC2 Hosts in the current region. The given filters must match exactly one host whose data will be exported as attributes.

  • filter - (Optional) Configuration block. Detailed below.
  • hostId - (Optional) ID of the Dedicated Host.

filter

This block allows for complex filters. You can use one or more filter blocks.

The following arguments are required:

  • name - (Required) Name of the field to filter by, as defined by the underlying AWS API.
  • values - (Required) Set of values that are accepted for the given field. A host will be selected if any one of the given values matches.

Attributes Reference

In addition to the attributes above, the following attributes are exported:

  • id - ID of the Dedicated Host.
  • arn - ARN of the Dedicated Host.
  • autoPlacement - Whether auto-placement is on or off.
  • availabilityZone - Availability Zone of the Dedicated Host.
  • cores - Number of cores on the Dedicated Host.
  • hostRecovery - Whether host recovery is enabled or disabled for the Dedicated Host.
  • instanceFamily - Instance family supported by the Dedicated Host. For example, "m5".
  • instanceType - Instance type supported by the Dedicated Host. For example, "m5.large". If the host supports multiple instance types, no instanceType is returned.
  • outpostArn - ARN of the AWS Outpost on which the Dedicated Host is allocated.
  • ownerId - ID of the AWS account that owns the Dedicated Host.
  • sockets - Number of sockets on the Dedicated Host.
  • totalVcpus - Total number of vCPUs on the Dedicated Host.

Timeouts

Configuration options:

  • read - (Default 20M)