AWS Amazon EC2 Placement Group

This page shows how to write Terraform and CloudFormation for Amazon EC2 Placement Group and write them securely.


Fix issues in your cloud & app configurations

Test for misconfigurations of this resource in your cloud.


Terraform Example (aws_placement_group)

Provides an EC2 placement group. Read more about placement groups in AWS Docs.


Example Usage (from GitHub)

resource "aws_placement_group" "managers" {
  name      = "managers"
  strategy  = "cluster"

resource "aws_placement_group" "workers" {
resource "aws_placement_group" "auto-pl-group" {
  name     = "auto-pl-group"
  strategy = "cluster"

resource "aws_autoscaling_group" "auto-auto-group" {
resource "aws_placement_group" "ehpark_place" {
    name = "ehpark-place"
    strategy = "cluster"

CloudFormation Example (AWS::EC2::PlacementGroup)

Specifies a placement group in which to launch instances. The strategy of the placement group determines how the instances are organized within the group. A cluster placement group is a logical grouping of instances within a single Availability Zone that benefit from low network latency, high network throughput. A spread placement group places instances on distinct hardware. A partition placement group places groups of instances in different partitions, where instances in one partition do not share the same hardware with instances in another partition.

For more information, see Placement Groups in the Amazon EC2 User Guide.


Frequently asked questions

What is AWS Amazon EC2 Placement Group?

AWS Amazon EC2 Placement Group is a resource for Amazon EC2 of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Amazon EC2 Placement Group?

For Terraform, the eggmuffin95/Container_Orchestration, k7nsuy/terraform and qpqpqp1224/terratest source code examples are useful. See the Terraform Example section for further details.