Skip to content

Resource: awsPlacementGroup

Provides an EC2 placement group. Read more about placement groups in AWS Docs.

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.placementGroup.PlacementGroup(this, "web", {
  name: "hunky-dory-pg",
  strategy: "cluster",
});

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the placement group.
  • partitionCount - (Optional) The number of partitions to create in the placement group. Can only be specified when the strategy is set to partition. Valid values are 1 - 7 (default is 2).
  • spreadLevel - (Optional) Determines how placement groups spread instances. Can only be used when the strategy is set to spread. Can be host or rack. host can only be used for Outpost placement groups. Defaults to rack.
  • strategy - (Required) The placement strategy. Can be cluster, partition or spread.
  • tags - (Optional) Key-value map of resource tags. 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:

  • arn - Amazon Resource Name (ARN) of the placement group.
  • id - The name of the placement group.
  • placementGroupId - The ID of the placement group.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

Placement groups can be imported using the name, e.g.,

$ terraform import aws_placement_group.prod_pg production-placement-group