An Overview of Different Placement Groups in AWS EC2

When you launch multiple EC2 instances on AWS, the EC2 service makes sure that all of your EC2 instances are spread across different physical machines to minimize the failure of the entire system. But AWS EC2 also provides the customers the ability to put the EC2 instance according to their need. Placement groups are used to determine how the EC2 instances are launched on the underlying hardware. AWS provides the following three types of placement groups strategies which you can use according to your workload.
  • Cluster placement group: It groups instances into low latency clusters in a single available zone(AZ).
  • Spread placement group: It spread the instances across underlying hardware.
  • Partition placement group: It spreads the instances across many different partitions within an AZ.

Cluster Placement Group

In the cluster placement group, all the instances are in the same rack in a single availability zone. Cluster placement groups are designed for high speed performance and low network latency applications as EC2 instances are physically on the same rack and it causes low latency between the EC2 instances in the same cluster placement group. It usually supports up to 10Gbps network. As the EC2 instances in the cluster placement group are in the same physical rack so the problem with cluster placement groups is if the rack fails, all the instances will fail at the same time compromising the high availability of the application.

Spread Placement Group

In the spread placement group, all EC2 instances are located on different hardware racks in a single availability zone. Each rack is isolated from others and has its own power and networks to reduce the failure of all the instances in the spread placement group at a time. You can create up to 7 EC2 instances per availability zone per spread placement group. Unlike Cluster placement groups, EC2 instances in the spread placement group exist on different hardware within the single availability zone minimizing the failure of all the EC2 instances at a time while making sure of the low latency. Spread placement groups are designed for applications that require maximum high availability and where each instance must be isolated from failure from each other.

Partition Placement Group

In the partition placement group, instances are launched into different partitions on different hardware racks to make sure of high availability. It can span across multiple AZs in the same region. The instances in a partition do not share racks with the instances in the other partitions. A partition failure can affect many EC2 instances in the same partition but won’t affect the EC2 instances on the other partitions. Partition placement groups are designed for applications that require maximum high availability. Partition placement groups are used for big application deployment and are ideal for large distributed and replicated workloads such as kafka, hadoop and cassandra etc.

Creating a placement group

Now in this section, we will see how we can create placement groups on AWS using the AWS management console and AWS command line interface.

Creating Placement Group Using AWS Console Management

First, log into the AWS management console and search for the EC2 service in the search bar.

From the left side window, select the Placement Groups option.

To create a placement group, click on the Create placement group button on the top right corner of the page.

Now it will ask for the name and the placement group strategy. Provide a name to your placement group whatever you want. In placement strategy, you need to choose the type of placement group i.e. cluster, spread and partition. For this demo, we will create the cluster placement group but you can choose any placement strategy you want. Now click on the create group button to create the cluster placement group.

In the case of a partition placement group, first give a name whatever you want. After that, in the placement strategy portion select the partition. Then, we need to provide the number of partitions for our placement group. After providing all the details, click on the create group button to create the placement group.

After creating the placement group, you can now launch EC2 instances in the placement group. You need to specify the placement group while launching the EC2 instance. While launching the EC2 instance, check the Placement group box in the EC2 instance configuration. Then you can select the placement group in which you want to launch the EC2 instance.

In case of the partition placement group, you can select the Target partition in which the EC2 instance will be launched.

Creating Placement Group Using AWS Command Line Interface (CLI)

In this section we will see how we can create a placement group on AWS using AWS command line interface. First you need to configure the AWS command line interface credentials. Visit the following article to learn how to configure the AWS command line interface credentials.

https://linuxhint.com/configure-aws-cli-credentials/

Now use the following command in the terminal to create the placement group.

$: aws ec2 create-placement-group \
 --group-name  \
 --strategy

In case of a partition placement group, you need to also specify the number of partitions.

$: aws ec2 create-placement-group \
 --group-name  \
 --strategy  \
 --partition-count

You can view the details of the placement group created by using the following command in the terminal.

$: aws ec2 describe-placement-groups \
 --group-names

Conclusion

Placement of the EC2 instances on AWS infrastructure is not fully controlled by AWS. You can also choose the placement of your EC2 instances according to your needs. AWS provides different types of placement strategies to place your EC2 instance depending upon the requirement of your application. You can place EC2 instances in different placement groups to make sure of the low latency or high availability of your application. This blog gives a brief overview of all the placement strategies and describes how you can create placement groups on AWS using AWS console and AWS command line interface.



from https://ift.tt/cFPyU6x

Post a Comment

0 Comments