How-To

Working with EC2 Placement Groups

Multi-tier applications are typically composed of services that span several virtual machine instances. While there is nothing stopping you from creating these EC2 instances in the usual way, AWS gives you the option of using placement groups, which helps you to strategically locate EC2 instances in a way that is beneficial to your workloads.

Creating a Placement Group
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.

Figure 1: Creating a placement group requires you to enter a group name and to choose a placement strategy.
[Click on image for larger view.] 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.

Figure 1: Creating a placement group requires you to enter a group name and to choose a placement strategy.
[Click on image for larger view.] 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 Groups
Cluster placement groups are intended for applications that require low latency and/or high throughput between the instances within the group. These groups provide 10 Gbps connectivity between instances. Internet connectivity by instances is limited to 5 Gbps, and connectivity to an S3 bucket (within a single region) can use all of the available aggregate bandwidth.

If you plan on using a cluster placement group, then Amazon recommends that you create all of the member instances at the same time, so as to avoid capacity related errors. Cluster placement groups can accommodate various types and sizes of instances, but Amazon recommends making all of the instances uniform. It is also worth noting that cluster placement groups cannot span availability zones.

Partition Placement Groups
Partition placement groups provide hardware redundancy, and are best suited to use with distributed or replicated workloads. When you create a partition placement group, AWS defines a number of partitions within the group and scatters the group instances across these partitions. The partitions share a common availability zone, but do not share hardware. In fact, each partition resides within a different rack in the AWS datacenter.

In case you are wondering, a partition group supports a maximum of seven partitions per availability zones. EC2 instances within the partition group are evenly distributed across these partitions. The exception to this is that a partition group containing dedicated instances can only have two partitions.

Spread Placement Groups
The third placement group strategy is the spread placement group. Instances in a spread placement group generally share a common availability zone, but can span availability zones. One of the key differences between a partition placement group and a spread placement group is that a spread placement group is limited to a maximum of seven running instances per availability zone. A partition placement group can accommodate a maximum of seven partitions per availability zone, but a single partition can service multiple instances. Keep in mind that a region can have multiple availability zones, so if a region has two availability zones, then a spread placement group could include up to 14 instances (7 in each of the two availability zones).

Besides the requirements for that pertain to the individual placement group strategies, there are also a few general rules that you will need to keep in mind as you work with placement groups. For starters, the name that you use must be unique within your AWS account (for the region). Additionally, an instance can only belong to a one placement group at a time, and no mechanism exists for merging placement groups. For more information check out the documentation.

About the Author

Brien Posey is a 22-time Microsoft MVP with decades of IT experience. As a freelance writer, Posey has written thousands of articles and contributed to several dozen books on a wide variety of IT topics. Prior to going freelance, Posey was a CIO for a national chain of hospitals and health care facilities. He has also served as a network administrator for some of the country's largest insurance companies and for the Department of Defense at Fort Knox. In addition to his continued work in IT, Posey has spent the last several years actively training as a commercial scientist-astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space. You can follow his spaceflight training on his Web site.

Featured

Subscribe on YouTube