Placement Groups in AWS

What is Placement Groups in AWS?

Till now we have learned what is Amazon Ec2, AWS IAM, Security Groups. Today we will discuss about Placement Groups in AWS.

  • Placement Groups in AWS determines how instances are placed on underlying hardware
  • AWS now provides three types of placement groups
    • Cluster – clusters instances into a low-latency group in a single AZ
    • Partition– spreads instances across logical partitions, ensuring that instances in one partition do not share underlying hardware with instances in other partitions
    • Spread– spreads instances across underlying hardware

Creating a Placement Groups in AWS:

Creating a placement group couldn’t be easier. Even so, it is important to understand the implications of your actions before you commit to using placement groups.

To create a placement group, just go into the EC2 console and click the Placement Groups tab. From there, you will be taken to the screen shown in Figure 1. This screen requires you to provide a name for the placement group that you are creating, and then choose a placement strategy. After doing so, simply click on the Create Group button to create a placement group.

Create Placement Group

Figure 1: Creating a placement group requires you to enter a group name and to choose a placement strategy.

When you create a new EC2 instance, AWS gives you the option of associating the instance with a placement group. As you can see in Figure 2, you will need to select the Add Instance to Placement Group checkbox, and then choose whether you want to add the instance to an existing placement group or create a new placement group.

Create Placement Group fig 2

Figure 2: You can associate a new EC2 instance with a placement group.

So far, I have shown you how to create and use a placement group, but I haven’t explained what placement groups actually do. As I explained a moment ago, creating a placement group involves providing a group name and choosing a placement strategy. AWS currently offers three strategies that you can choose between. These include Cluster, Spread, and Partition.

Cluster Placement Group

Cluster Placement group is a logical grouping of instances within a single Availability Zone

Cluster Placement group doesn’t span across Availability Zones

It impacts High Availability as susceptible to hardware failures for the application

It is recommended for

  • applications that benefits from low network latency, high network throughput, or both.
  • when most of the network traffic is between the instances in the group

To provide the lowest latency, and the highest packet-per-second network performance for the placement group, choose an instance type that supports enhanced networking

It is recommended to launch all group instances at the same time to ensure enough capacity.

The instances can be added later, but there are chances of encountering an insufficient capacity error. For moving an instance into the placement group,

  • create an AMI from the existing instance,
  • and then launch a new instance from the AMI into a placement group.

Stopping and starting an instance within the placement group, the instance still runs in the same placement group

In case of a capacity error, stop and start all of the instances in the placement group, and try the launch again. Restarting the instances may migrate them to hardware that has capacity for all requested instances

It’s only available within a single AZ either in the same VPC or peered VPCs

It is more of an hint to AWS that the instances need to be launched physically close to each together

It enables applications to participate in a low-latency, 10 Gbps network.

Partition Placement Groups:

  • is a group of instances spread across partitions e. group of instances spread across racks.
  • Partitions are logical groupings of instances, where contained instances do not share the same underlying hardware across different partitions.
  • EC2 divides each group into logical segments called partitions.
  • EC2 ensures that each partition within a placement group has its own set of racks. Each rack has its own network and power source.
  • Spread instances across many different partitions withing AZ. Scales to 100s of EC2 instances per group (Hadoop, kafka, cassendra)
  • No two partitions within a placement group share the same racks, allowing isolating the impact of hardware failure within the application.
  • reduces the likelihood of correlated hardware failures for the application.
  • can be used to spread deployment of large distributed and replicated workloads, such as HDFS, HBase, and Cassandra, across distinct hardware
  • can have a maximum of seven partitions per Availability Zone
  • number of instances that can be launched into a partition placement group is limited only by the limits of the account.
  • can span multiple Availability Zones in the same Region.

Availability Zones

Spread Placement Groups

  • is a group of instances that are each placed on distinct underlying hardware i.e. each instance on distinct rack
  • recommended for applications that have a small number of critical instances that should be kept separate from each other.
  • reduces the risk of simultaneous failures that might occur when instances share the same underlying hardware.
  • provide access to distinct hardware, and are therefore suitable for mixing instance types or launching instances over time.
  • can span multiple Availability Zones
  • can have a maximum of seven running instances per AZ per group
  • maximum number of instances = 1 instance per rack * 7 racks * No. of AZs for e.g. in a Region with three AZs, a total of 21 instances in the group (seven per zone) can be launched
  • If the start or launch an instance in a spread placement group fails cause of insufficient unique hardware to fulfill the request, the request can be tried later as EC2 makes more distinct hardware available over time

Availability Zones

Placement Groups in AWS – Rules and Limitations

  • Ensure unique Placement group name within AWS account for the region
  • Placement groups cannot be merged
  • An instance can be launched in one placement group at a time; it cannot span multiple placement groups.
  • Instances with a tenancy of host cannot be launched in placement groups.
  • Cluster Placement group
    • can’t span multiple Availability Zones.
    • supported by Specific Instance types which support 10 Gigabyte network
    • maximum network throughput speed of traffic between two instances in a cluster placement group is limited by the slower of the two instances, so choose the instance type properly.
    • can use up to 10 Gbps for single-flow traffic.
    • Traffic to and from S3 buckets within the same region over the public IP address space or through a VPC endpoint can use all available instance aggregate bandwidth.
    • recommended to use the same instance type. homogenous instance types. Although multiple instance types can be launched into a cluster placement group. However, this reduces the likelihood that the required capacity will be available for your launch to succeed
    • Network traffic to the internet and over an AWS Direct Connect connection to on-premises resources is limited to 5 Gbps.
  • Partition placement groups
    • supports a maximum of seven partitions per Availability Zone
    • with Dedicated Instances can have a maximum of two partitions
    • are not supported for Dedicated Hosts
    • are currently only available through the API or AWS CLI.
  • Spread placement groups
    • supports a maximum of seven running instances per Availability Zonefor e.g., in a region that has three AZs, then a total of 21 running instances in the group (seven per zone).
    • are not supported for Dedicated Instances or Dedicated Hosts.

Please find below in details:

Cluster Spread Partition
Pros Great Network. 10 gbps bandwidth between instances. Can span across AZs.

EC2 instances are on different physical device.

Upto 7  partitions per AZ. Up to 100s of EC2 instances. A partition can affect many EC2 but not partitions.
Cons If the racks fails, all the instances fails at the same time.

Cluster is not available for t2.micro (free version)

Limited to 7 instances per AZ per placement group
Use Case: Big Data jobs Applications that needs high availability. HDFC, Hbase,Cassendra , Kafka etc

This is all about the basic of Placement Groups in AWS.

Happy Learning !!

Related Posts:

Amazon Web Service – AWS Tutorial

Top 13 Reasons to Why Learn AWS in 2022

What is AWS? Amazon Cloud (Web) Services Tutorial for Beginners

What is Amazon EC2?