aws.ec2.PlacementGroup
Explore with Pulumi AI
Provides an EC2 placement group. Read more about placement groups in AWS Docs.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const web = new aws.ec2.PlacementGroup("web", {
name: "hunky-dory-pg",
strategy: aws.ec2.PlacementStrategy.Cluster,
});
import pulumi
import pulumi_aws as aws
web = aws.ec2.PlacementGroup("web",
name="hunky-dory-pg",
strategy=aws.ec2.PlacementStrategy.CLUSTER)
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.NewPlacementGroup(ctx, "web", &ec2.PlacementGroupArgs{
Name: pulumi.String("hunky-dory-pg"),
Strategy: pulumi.String(ec2.PlacementStrategyCluster),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var web = new Aws.Ec2.PlacementGroup("web", new()
{
Name = "hunky-dory-pg",
Strategy = Aws.Ec2.PlacementStrategy.Cluster,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.PlacementGroup;
import com.pulumi.aws.ec2.PlacementGroupArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var web = new PlacementGroup("web", PlacementGroupArgs.builder()
.name("hunky-dory-pg")
.strategy("cluster")
.build());
}
}
resources:
web:
type: aws:ec2:PlacementGroup
properties:
name: hunky-dory-pg
strategy: cluster
Create PlacementGroup Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new PlacementGroup(name: string, args: PlacementGroupArgs, opts?: CustomResourceOptions);
@overload
def PlacementGroup(resource_name: str,
args: PlacementGroupArgs,
opts: Optional[ResourceOptions] = None)
@overload
def PlacementGroup(resource_name: str,
opts: Optional[ResourceOptions] = None,
strategy: Optional[Union[str, PlacementStrategy]] = None,
name: Optional[str] = None,
partition_count: Optional[int] = None,
spread_level: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None)
func NewPlacementGroup(ctx *Context, name string, args PlacementGroupArgs, opts ...ResourceOption) (*PlacementGroup, error)
public PlacementGroup(string name, PlacementGroupArgs args, CustomResourceOptions? opts = null)
public PlacementGroup(String name, PlacementGroupArgs args)
public PlacementGroup(String name, PlacementGroupArgs args, CustomResourceOptions options)
type: aws:ec2:PlacementGroup
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args PlacementGroupArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args PlacementGroupArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args PlacementGroupArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PlacementGroupArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PlacementGroupArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var placementGroupResource = new Aws.Ec2.PlacementGroup("placementGroupResource", new()
{
Strategy = "string",
Name = "string",
PartitionCount = 0,
SpreadLevel = "string",
Tags =
{
{ "string", "string" },
},
});
example, err := ec2.NewPlacementGroup(ctx, "placementGroupResource", &ec2.PlacementGroupArgs{
Strategy: pulumi.String("string"),
Name: pulumi.String("string"),
PartitionCount: pulumi.Int(0),
SpreadLevel: pulumi.String("string"),
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var placementGroupResource = new PlacementGroup("placementGroupResource", PlacementGroupArgs.builder()
.strategy("string")
.name("string")
.partitionCount(0)
.spreadLevel("string")
.tags(Map.of("string", "string"))
.build());
placement_group_resource = aws.ec2.PlacementGroup("placementGroupResource",
strategy="string",
name="string",
partition_count=0,
spread_level="string",
tags={
"string": "string",
})
const placementGroupResource = new aws.ec2.PlacementGroup("placementGroupResource", {
strategy: "string",
name: "string",
partitionCount: 0,
spreadLevel: "string",
tags: {
string: "string",
},
});
type: aws:ec2:PlacementGroup
properties:
name: string
partitionCount: 0
spreadLevel: string
strategy: string
tags:
string: string
PlacementGroup Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The PlacementGroup resource accepts the following input properties:
- Strategy
string | Pulumi.
Aws. Ec2. Placement Strategy - The placement strategy. Can be
cluster
,partition
orspread
. - Name string
- The name of the placement group.
- Partition
Count int - The number of partitions to create in the
placement group. Can only be specified when the
strategy
is set topartition
. Valid values are 1 - 7 (default is2
). - Spread
Level string - Determines how placement groups spread instances. Can only be used
when the
strategy
is set tospread
. Can behost
orrack
.host
can only be used for Outpost placement groups. Defaults torack
. - Dictionary<string, string>
- Key-value map of resource tags. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- Strategy
string | Placement
Strategy - The placement strategy. Can be
cluster
,partition
orspread
. - Name string
- The name of the placement group.
- Partition
Count int - The number of partitions to create in the
placement group. Can only be specified when the
strategy
is set topartition
. Valid values are 1 - 7 (default is2
). - Spread
Level string - Determines how placement groups spread instances. Can only be used
when the
strategy
is set tospread
. Can behost
orrack
.host
can only be used for Outpost placement groups. Defaults torack
. - map[string]string
- Key-value map of resource tags. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- strategy
String | Placement
Strategy - The placement strategy. Can be
cluster
,partition
orspread
. - name String
- The name of the placement group.
- partition
Count Integer - The number of partitions to create in the
placement group. Can only be specified when the
strategy
is set topartition
. Valid values are 1 - 7 (default is2
). - spread
Level String - Determines how placement groups spread instances. Can only be used
when the
strategy
is set tospread
. Can behost
orrack
.host
can only be used for Outpost placement groups. Defaults torack
. - Map<String,String>
- Key-value map of resource tags. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- strategy
string | Placement
Strategy - The placement strategy. Can be
cluster
,partition
orspread
. - name string
- The name of the placement group.
- partition
Count number - The number of partitions to create in the
placement group. Can only be specified when the
strategy
is set topartition
. Valid values are 1 - 7 (default is2
). - spread
Level string - Determines how placement groups spread instances. Can only be used
when the
strategy
is set tospread
. Can behost
orrack
.host
can only be used for Outpost placement groups. Defaults torack
. - {[key: string]: string}
- Key-value map of resource tags. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- strategy
str | Placement
Strategy - The placement strategy. Can be
cluster
,partition
orspread
. - name str
- The name of the placement group.
- partition_
count int - The number of partitions to create in the
placement group. Can only be specified when the
strategy
is set topartition
. Valid values are 1 - 7 (default is2
). - spread_
level str - Determines how placement groups spread instances. Can only be used
when the
strategy
is set tospread
. Can behost
orrack
.host
can only be used for Outpost placement groups. Defaults torack
. - Mapping[str, str]
- Key-value map of resource tags. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
- strategy String | "spread" | "cluster"
- The placement strategy. Can be
cluster
,partition
orspread
. - name String
- The name of the placement group.
- partition
Count Number - The number of partitions to create in the
placement group. Can only be specified when the
strategy
is set topartition
. Valid values are 1 - 7 (default is2
). - spread
Level String - Determines how placement groups spread instances. Can only be used
when the
strategy
is set tospread
. Can behost
orrack
.host
can only be used for Outpost placement groups. Defaults torack
. - Map<String>
- Key-value map of resource tags. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Outputs
All input properties are implicitly available as output properties. Additionally, the PlacementGroup resource produces the following output properties:
- Arn string
- Amazon Resource Name (ARN) of the placement group.
- Id string
- The provider-assigned unique ID for this managed resource.
- Placement
Group stringId - The ID of the placement group.
- Dictionary<string, string>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- Arn string
- Amazon Resource Name (ARN) of the placement group.
- Id string
- The provider-assigned unique ID for this managed resource.
- Placement
Group stringId - The ID of the placement group.
- map[string]string
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn String
- Amazon Resource Name (ARN) of the placement group.
- id String
- The provider-assigned unique ID for this managed resource.
- placement
Group StringId - The ID of the placement group.
- Map<String,String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn string
- Amazon Resource Name (ARN) of the placement group.
- id string
- The provider-assigned unique ID for this managed resource.
- placement
Group stringId - The ID of the placement group.
- {[key: string]: string}
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn str
- Amazon Resource Name (ARN) of the placement group.
- id str
- The provider-assigned unique ID for this managed resource.
- placement_
group_ strid - The ID of the placement group.
- Mapping[str, str]
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn String
- Amazon Resource Name (ARN) of the placement group.
- id String
- The provider-assigned unique ID for this managed resource.
- placement
Group StringId - The ID of the placement group.
- Map<String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
Look up Existing PlacementGroup Resource
Get an existing PlacementGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: PlacementGroupState, opts?: CustomResourceOptions): PlacementGroup
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
arn: Optional[str] = None,
name: Optional[str] = None,
partition_count: Optional[int] = None,
placement_group_id: Optional[str] = None,
spread_level: Optional[str] = None,
strategy: Optional[Union[str, PlacementStrategy]] = None,
tags: Optional[Mapping[str, str]] = None,
tags_all: Optional[Mapping[str, str]] = None) -> PlacementGroup
func GetPlacementGroup(ctx *Context, name string, id IDInput, state *PlacementGroupState, opts ...ResourceOption) (*PlacementGroup, error)
public static PlacementGroup Get(string name, Input<string> id, PlacementGroupState? state, CustomResourceOptions? opts = null)
public static PlacementGroup get(String name, Output<String> id, PlacementGroupState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Arn string
- Amazon Resource Name (ARN) of the placement group.
- Name string
- The name of the placement group.
- Partition
Count int - The number of partitions to create in the
placement group. Can only be specified when the
strategy
is set topartition
. Valid values are 1 - 7 (default is2
). - Placement
Group stringId - The ID of the placement group.
- Spread
Level string - Determines how placement groups spread instances. Can only be used
when the
strategy
is set tospread
. Can behost
orrack
.host
can only be used for Outpost placement groups. Defaults torack
. - Strategy
string | Pulumi.
Aws. Ec2. Placement Strategy - The placement strategy. Can be
cluster
,partition
orspread
. - Dictionary<string, string>
- Key-value map of resource tags. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - Dictionary<string, string>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- Arn string
- Amazon Resource Name (ARN) of the placement group.
- Name string
- The name of the placement group.
- Partition
Count int - The number of partitions to create in the
placement group. Can only be specified when the
strategy
is set topartition
. Valid values are 1 - 7 (default is2
). - Placement
Group stringId - The ID of the placement group.
- Spread
Level string - Determines how placement groups spread instances. Can only be used
when the
strategy
is set tospread
. Can behost
orrack
.host
can only be used for Outpost placement groups. Defaults torack
. - Strategy
string | Placement
Strategy - The placement strategy. Can be
cluster
,partition
orspread
. - map[string]string
- Key-value map of resource tags. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - map[string]string
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn String
- Amazon Resource Name (ARN) of the placement group.
- name String
- The name of the placement group.
- partition
Count Integer - The number of partitions to create in the
placement group. Can only be specified when the
strategy
is set topartition
. Valid values are 1 - 7 (default is2
). - placement
Group StringId - The ID of the placement group.
- spread
Level String - Determines how placement groups spread instances. Can only be used
when the
strategy
is set tospread
. Can behost
orrack
.host
can only be used for Outpost placement groups. Defaults torack
. - strategy
String | Placement
Strategy - The placement strategy. Can be
cluster
,partition
orspread
. - Map<String,String>
- Key-value map of resource tags. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - Map<String,String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn string
- Amazon Resource Name (ARN) of the placement group.
- name string
- The name of the placement group.
- partition
Count number - The number of partitions to create in the
placement group. Can only be specified when the
strategy
is set topartition
. Valid values are 1 - 7 (default is2
). - placement
Group stringId - The ID of the placement group.
- spread
Level string - Determines how placement groups spread instances. Can only be used
when the
strategy
is set tospread
. Can behost
orrack
.host
can only be used for Outpost placement groups. Defaults torack
. - strategy
string | Placement
Strategy - The placement strategy. Can be
cluster
,partition
orspread
. - {[key: string]: string}
- Key-value map of resource tags. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - {[key: string]: string}
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn str
- Amazon Resource Name (ARN) of the placement group.
- name str
- The name of the placement group.
- partition_
count int - The number of partitions to create in the
placement group. Can only be specified when the
strategy
is set topartition
. Valid values are 1 - 7 (default is2
). - placement_
group_ strid - The ID of the placement group.
- spread_
level str - Determines how placement groups spread instances. Can only be used
when the
strategy
is set tospread
. Can behost
orrack
.host
can only be used for Outpost placement groups. Defaults torack
. - strategy
str | Placement
Strategy - The placement strategy. Can be
cluster
,partition
orspread
. - Mapping[str, str]
- Key-value map of resource tags. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - Mapping[str, str]
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- arn String
- Amazon Resource Name (ARN) of the placement group.
- name String
- The name of the placement group.
- partition
Count Number - The number of partitions to create in the
placement group. Can only be specified when the
strategy
is set topartition
. Valid values are 1 - 7 (default is2
). - placement
Group StringId - The ID of the placement group.
- spread
Level String - Determines how placement groups spread instances. Can only be used
when the
strategy
is set tospread
. Can behost
orrack
.host
can only be used for Outpost placement groups. Defaults torack
. - strategy String | "spread" | "cluster"
- The placement strategy. Can be
cluster
,partition
orspread
. - Map<String>
- Key-value map of resource tags. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level. - Map<String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
Supporting Types
PlacementStrategy, PlacementStrategyArgs
- Spread
- spreadA
spread
placement group places instances on distinct hardware. - Cluster
- clusterA
cluster
placement group is a logical grouping of instances within a single Availability Zone that benefit from low network latency, high network throughput.
- Placement
Strategy Spread - spreadA
spread
placement group places instances on distinct hardware. - Placement
Strategy Cluster - clusterA
cluster
placement group is a logical grouping of instances within a single Availability Zone that benefit from low network latency, high network throughput.
- Spread
- spreadA
spread
placement group places instances on distinct hardware. - Cluster
- clusterA
cluster
placement group is a logical grouping of instances within a single Availability Zone that benefit from low network latency, high network throughput.
- Spread
- spreadA
spread
placement group places instances on distinct hardware. - Cluster
- clusterA
cluster
placement group is a logical grouping of instances within a single Availability Zone that benefit from low network latency, high network throughput.
- SPREAD
- spreadA
spread
placement group places instances on distinct hardware. - CLUSTER
- clusterA
cluster
placement group is a logical grouping of instances within a single Availability Zone that benefit from low network latency, high network throughput.
- "spread"
- spreadA
spread
placement group places instances on distinct hardware. - "cluster"
- clusterA
cluster
placement group is a logical grouping of instances within a single Availability Zone that benefit from low network latency, high network throughput.
Import
Using pulumi import
, import placement groups using the name
. For example:
$ pulumi import aws:ec2/placementGroup:PlacementGroup prod_pg production-placement-group
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.