Skip to content

Resource: awsEc2Host

Provides an EC2 Host resource. This allows Dedicated Hosts to be allocated, modified, and released.

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";
new aws.ec2Host.Ec2Host(this, "test", {
  autoPlacement: "on",
  availabilityZone: "us-west-2a",
  hostRecovery: "on",
  instanceType: "c5.18xlarge",
});

Argument Reference

The following arguments are supported:

  • autoPlacement - (Optional) Indicates whether the host accepts any untargeted instance launches that match its instance type configuration, or if it only accepts Host tenancy instance launches that specify its unique host ID. Valid values: on, off. Default: on.
  • availabilityZone - (Required) The Availability Zone in which to allocate the Dedicated Host.
  • hostRecovery - (Optional) Indicates whether to enable or disable host recovery for the Dedicated Host. Valid values: on, off. Default: off.
  • instanceFamily - (Optional) Specifies the instance family to be supported by the Dedicated Hosts. If you specify an instance family, the Dedicated Hosts support multiple instance types within that instance family. Exactly one of instanceFamily or instanceType must be specified.
  • instanceType - (Optional) Specifies the instance type to be supported by the Dedicated Hosts. If you specify an instance type, the Dedicated Hosts support instances of the specified instance type only. Exactly one of instanceFamily or instanceType must be specified.
  • outpostArn - (Optional) The Amazon Resource Name (ARN) of the AWS Outpost on which to allocate the Dedicated Host.
  • tags - (Optional) Map of tags to assign to this resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Attributes Reference

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

  • id - The ID of the allocated Dedicated Host. This is used to launch an instance onto a specific host.
  • arn - The ARN of the Dedicated Host.
  • ownerId - The ID of the AWS account that owns the Dedicated Host.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

Hosts can be imported using the host id, e.g.,

$ terraform import aws_ec2_host.example h-0385a99d0e4b20cbb