What are The AWS EC2 Instance Placement Groups?

What are The AWS EC2 Instance Placement Groups?

In this short article, you will learn: What are the EC2 placement groups? Why do we need them? How to use them?

The Problem:

AWS can launch multiple EC2 instances which may share the same underlying hardware.

Scenario 1:

Suppose you have launched two EC2 instances in a single availability zone. These Instances may or may not be sharing the same underlying hardware. If both of the EC2 instances are running on the same underlying hardware and the underlying hardware fails it will disrupt both of the EC2 Instances.

Scenario 2:

Assume that you have launched a cluster of EC2 instances in a single availability zone, running a latency-critical big data application. AWS launched your EC2 instances in such a way that they don’t share the same underlying hardware and they are far from each other. This can cause latency issues. So in this case you want your EC2 Instances to share the same underlying hardware, and be close as much as possible.

The solution:

To counter this type of instance placement issues you need to use the EC2 Placement groups. With the help of placement groups, you can define how your instances should be placed. Placement groups can be used while launching EC2 instances. The placement group offers the following placement strategies.

Cluster: Clusters instances closely together inside a single Availability Zone. This helps to achieve low-latency network performance. Used for high-performance computing (HPC) applications that require tightly-coupled node-to-node communication.

Spread: Strictly places a small group of instances across separate underlying hardware to reduce correlated failures. (max 7 instances per group per AZ)

Partition: Spreads your instances across logical partitions(you can think of a server rack) 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.

To create a placement group go to EC2 console > Network & Security > Placement Groups and configure the placement group.

image.png

While launching the EC2 Instances go to the Advance Details tab and select your placement group.

image.png

Congratulations 🎉 now you are ready to use the placement groups. If not you can ask me your queries in the comment section. Don’t forget to follow me for similar content.