> For the complete documentation index, see [llms.txt](https://karansingh.gitbook.io/aws-saa-c02/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://karansingh.gitbook.io/aws-saa-c02/ec2/placement-groups.md).

# Placement Groups

* When you launch a new EC2 instance, the EC2 service attempts to place the instance in such a way that all of your instances are spread out across underlying hardware to minimize correlated failures.<br>
* Can use **placement groups to influence the placement of a group of interdependent instances** to meet the needs of your workload.

## Cluster Placement Groups

* **Packs instances close together within only 1 Availability Zone**.
  * This means it has **not got very high availability** as all the instances are in one AZ.<br>

* This strategy **enables workloads to achieve the low-latency network** performance necessary for tightly-coupled node-to-node communication that is typical of **HPC applications**.<br>

* **AWS recommends to:**

  * **Launch all instances at the same time**.<br>
  * **Use the same instance type for all instances in the placement group**.

* Instances within a cluster placement group **can use up to 10 Gbps for single-flow traffic**.
  * Instances that are not within a cluster placement group can use up to 5 Gbps for single-flow traffic.

## Spread Placement Groups

* This strategy strictly **places a small group of instances across distinct underlying hardware to reduce correlated failures**.<br>

* Recommended **for applications that have a small number of critical instances that should be kept separate from each other**.<br>

* Launching instances in a spread placement group **reduces the risk of simultaneous failures** that might occur when instances share the same racks.

* Can **span multiple Availability Zones** in the same Region.<br>

* You can only have a **maximum of 7 running instances per Availability Zone per placement group**.

## Partition Placement Groups

* This **spreads your instances across logical partitions such that groups of instances in one partition do not share the underlying hardware with groups of instances in different partitions**.<br>
* It is typically used by **large distributed and replicated workloads**, such as **Hadoop, Cassandra, and Kafka**.<br>
* Help **reduce the likelihood of correlated hardware failures for your application**.<br>
* **EC2 divides each group into logical segments called partitions**.
  * EC2 **ensures that each partition within a placement group has its own set of racks**.<br>
  * **No two partitions within a placement group share the same racks**.<br>
* You can **launch instances into a specific partition to have more control**.<br>
* You **can have partitions in multiple Availability Zones in the same Region**.<br>
* You can only have a **maximum of 7 partitions per Availability Zone**.
  * However, you can have **100s of EC2 Instances in the placement group**.

## Spread vs Placement Groups

* **Spread Placement Groups:**
  * Have **individual instances all on separate hardware**.<br>
  * Recommended **for applications that have a small number of critical instances that should be kept separate from each other**.

* **Partition Placement Groups:**
  * Described as **large groups of instances where each group is placed on separate hardware**.<br>
  * **Each partition comprises multiple instances**.<br>
  * The **instances in a partition do not share racks with the instances in the other partitions, allowing you to contain the impact of a single hardware failure to only the associated partition**.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://karansingh.gitbook.io/aws-saa-c02/ec2/placement-groups.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
