# PlacementGroupStrategy

Which strategy to use when launching instances.

- Source: [`aws-ec2/lib/placement-group.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ec2/lib/placement-group.ts#L126)
- Type last changed: v2.74.0 · 13 Apr 2023

## Example

```ts
declare const instanceType: ec2.InstanceType;

const pg = new ec2.PlacementGroup(this, 'test-pg', {
  strategy: ec2.PlacementGroupStrategy.SPREAD,
});

new ec2.Instance(this, 'Instance', {
  vpc,
  instanceType,
  machineImage: ec2.MachineImage.latestAmazonLinux2023(),
  placementGroup: pg,
});
```

## Members

| Member | Description |
| --- | --- |
| `CLUSTER` | Packs instances close together inside an Availability Zone. |
| `PARTITION` | Spreads your instances across logical partitions such that groups of instances in one partition do not share the underlying hardware with groups of instances in different partitions. |
| `SPREAD` | Strictly places a small group of instances across distinct underlying hardware to reduce correlated failures. |

## Referenced by

- [`IPlacementGroup`](/v2/docs/aws-cdk-lib.aws_ec2.IPlacementGroup).strategy
- [`PlacementGroup`](/v2/docs/aws-cdk-lib.aws_ec2.PlacementGroup).strategy
- [`PlacementGroupProps`](/v2/docs/aws-cdk-lib.aws_ec2.PlacementGroupProps).strategy
