You can use placement groups to influence how EC2 instances are placed.
Types of Placement Groups
- Cluster Placement Groups (CPG)
- Instances are placed physically near each other in a single AZ
- CPGs are used for max performance and low latency.
- Partitioned Placement Group (PPG)
- Instances are separated in partitions (max of 7 per AZ) and can span multiple AZs.
- Multiple instances can be placed in a partition: high availability with partition control.
- PPGs are used for large distributive systems such as HDFS, HBase, and Cassandra.
- Spread Placement Group (SPG)
- Max of 7 per AZ.
- Each instance is placed in a distinct underlying hardware (a partition): max availability.
- SPGs used for a small number of critical instances
- A cluster placement group cannot span multiple AZs, but a spread group or a partitioned group can span multiple AZs.
- The name of the placement group must be unique within your AWS account.
- Only specific types of instances can be launched in a placement group.
- AWS recommends launch homogeneous instances within a clustered placement group.
- You cannot move an existing running instance to a placement group.
- To move an instance into or out of a placement group:
- You need to stop the instance first.
- Use the CLI API (modify-instance-placement)
- Restart the instance
- You cannot merge placement groups.
- If you receive a capacity error ‘Insufficient Capacity Error’ when launching an instance in a placement group that already has running instances, stop and start all of the instances in the placement group, and try the launch again. Starting the instances may migrate them to the hardware that has capacity for all of the requested instances.