PlacementGroupStrategy

class aws_cdk.aws_ec2.PlacementGroupStrategy(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Which strategy to use when launching instances.

ExampleMetadata:

fixture=with-vpc infused

Example:

# instance_type: ec2.InstanceType


pg = ec2.PlacementGroup(self, "test-pg",
    strategy=ec2.PlacementGroupStrategy.SPREAD
)

ec2.Instance(self, "Instance",
    vpc=vpc,
    instance_type=instance_type,
    machine_image=ec2.MachineImage.latest_amazon_linux2023(),
    placement_group=pg
)

Attributes

CLUSTER

Packs instances close together inside an Availability Zone.

This strategy enables workloads to achieve the low-latency network performance necessary for tightly-coupled node-to-node communication that is typical of high-performance computing (HPC) applications.

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.

This strategy is typically used by large distributed and replicated workloads, such as Hadoop, Cassandra, and Kafka.

SPREAD

Strictly places a small group of instances across distinct underlying hardware to reduce correlated failures.