DEV Community

Payal Gupta for AWS Community Builders

Posted on

Working with Placement groups in Amazon EC2

This blog will cover the following content:

  1. What is a Placement Group in Amazon EC2?
  2. What are the benefits of using placement group?
  3. How to create placement group, and launch instances in placement group?

Let's get started...

What is a Placement Group in Amazon EC2?

Placement group is a way to impact the placement of interdependent EC2 instance groups in order to suit your workload requirements. AWS provides three placement strategies which you can use based on the type of your workload:

  1. Cluster Placement Groups: A logical grouping of instances within a single AZ.
  2. Partition Placement Groups: Logical partition of instance groups such that no two partitions within a placement group share the same underlying hardware.
  3. Spread Placement Groups: each instance within a spread placement group will be placed in a different rack.

What are the benefits of using placement group?

Cluster Placement group benefits:

  • Recommended for low network latency, and/or high network throughput applications.
  • Only specific to a single AZ
  • Can span peered VPCs in the same Region

Partition Placement Group benefits:

  • Reduces the impact of correlated hardware failures for your application
  • Mainly used to deploy large distributed and replicated workloads, such as HDFS, HBase, and Cassandra, across distinct racks.
  • Can have partitions in multiple Availability Zones in the same Region.
  • Offer visibility into the partitions using which you can check which instance is in which partition. Topology-aware applications, such as HDFS, HBase, and Cassandra use this information to make intelligent data replication decisions for increasing data availability and durability.

Spread Placement Group benefits:

  • 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 racks which is not the case in spread placement group
  • Can span multiple Availability Zones in the same Region.

How to create placement group, and launch instances in placement group?

Before using placement groups, I would suggest you to go through the rules and limitations of placement groups once for awareness.

To create a placement group,

  1. Go to Amazon EC2 console
  2. In the left pane, go to Network & Security -> choose Placement Groups -> Create placement group.

create placement group

  1. Fill the details in the fly-out
    Name: Specify the name of your placement group
    Placement strategy: choose the strategy from the drop-down
    Tags: Optionally assign tag values to the placement group

  2. Click Create Group

In my account, I created 3 placement groups with cluster, spread, and partition startegies as shown below.

placement groups

Launch instance in placement group

  1. Go to EC2 console -> Instances
  2. Click launch instances in the top right corner
  3. Launch instance with the following steps:
  4. Step 1: Choose AMI as per your requirements
  5. Step 2: Choose instance type by keeping in mind the limitations of your placement group. Example: You cannot lanuch t2 type instances in Cluster placement group because burstable performance instances such as T2 are not supported by cluster placement group. Hence, make sure to choose the instance type which is supported by the placement group in which you are planning to launch it otherwise, you will receive an error message as shown in the screenshot below.

error message

  • Step 3: Configure Instance Details This is the step where you will specify the instance details required for your placement group.

Number of instances: Enter the total number of instances that you need in this placement group, because you might not be able to add instances to the placement group later.

Placement group: Select the Add instance to placement group check box

Placement group name: You can choose to add the instances to an existing placement group or to a new placement group that you create

Placement group strategy: Choose the appropriate strategy.
If you choose partition, for Target partition, choose Auto distribution to have Amazon EC2 do a best effort to distribute the instances evenly across all the partitions in the group. Alternatively, you have the option and control to specify the partition in which to launch the instances.

configure details

  • Step 4: Add Storage to your instances
  • Step 5: Add tags such as Name tag
  • Step 6: Configure Security group for your instances
  • Step 7: Review and Launch
  • If everything looks fine, click launch in the bottom right corner to launch the instances.

I created 3 instances in partition placement group as shown below.

ec2

Additionally, to check the placement group details of your instance, select the instance -> go to Details section of your instance and scroll down to Host & placement group section. You can find the placement group name, and partition number etc.

Hope this information is helpful. Thank you.

Top comments (0)