Placement Groups are a logical group where EC2 instances are placed in one common availability zone to reduce latency for the applications.
- You are required to use a distinct name(within the AWS account) when creating a placement group.
- An instance can only belong to one placement group at a time.
- Instances with a tenancy of host cannot be launched in placement groups.
There are 2 strategies that can be followed when creating a placement group –
Cluster Placement Group –
It is a logical grouping of instances within a single Availability Zone. It is important to note that cluster placement groups cannot span across multiple availability zones. All the instances/nodes in the placement group can communicate with other instances/nodes in the group at the full line rate of 10 Gbps flows. It is recommended to launch all the instances (also use the same instance type) that are required in a single launch in the placement group. This avoids getting an “insufficient capacity error” when you try to launch instances later into the placement group. If an instance is stopped and started again, it will be placed again in the same placement group. However, there are chances to get the “insufficient capacity error”. To avoid this error, generally restarting all the instances in the placement group will try to launch them in another hardware where sufficient capacity exists. You can launch General Purpose(except T2 and T3), Compute Optimized, Storage Optimized, Memory Optimized and Accelerated Computing instances in a cluster placement group.
Spread Placement Group –
It is a group of instances that are each placed on a distinct underlying hardware. This type of placement group is recommended to avoid placing critical instances of the application on the same underlying hardware. This reduces the risk of failures. Spread placement group can spread across different availability zones. There is a limit of 7 running instances per Availability Zone per group. Spread placement groups are not supported for Dedicated Instances or Dedicated Hosts.