1. Packages
  2. AWS Classic
  3. API Docs
  4. ec2
  5. PlacementGroup

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi

aws.ec2.PlacementGroup

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi

    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.

    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.PlacementStrategy
    The placement strategy. Can be cluster, partition or spread.
    Name string
    The name of the placement group.
    PartitionCount int
    The number of partitions to create in the placement group. Can only be specified when the strategy is set to partition. Valid values are 1 - 7 (default is 2).
    SpreadLevel string
    Determines how placement groups spread instances. Can only be used when the strategy is set to spread. Can be host or rack. host can only be used for Outpost placement groups. Defaults to rack.
    Tags 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 | PlacementStrategy
    The placement strategy. Can be cluster, partition or spread.
    Name string
    The name of the placement group.
    PartitionCount int
    The number of partitions to create in the placement group. Can only be specified when the strategy is set to partition. Valid values are 1 - 7 (default is 2).
    SpreadLevel string
    Determines how placement groups spread instances. Can only be used when the strategy is set to spread. Can be host or rack. host can only be used for Outpost placement groups. Defaults to rack.
    Tags 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 | PlacementStrategy
    The placement strategy. Can be cluster, partition or spread.
    name String
    The name of the placement group.
    partitionCount Integer
    The number of partitions to create in the placement group. Can only be specified when the strategy is set to partition. Valid values are 1 - 7 (default is 2).
    spreadLevel String
    Determines how placement groups spread instances. Can only be used when the strategy is set to spread. Can be host or rack. host can only be used for Outpost placement groups. Defaults to rack.
    tags 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 | PlacementStrategy
    The placement strategy. Can be cluster, partition or spread.
    name string
    The name of the placement group.
    partitionCount number
    The number of partitions to create in the placement group. Can only be specified when the strategy is set to partition. Valid values are 1 - 7 (default is 2).
    spreadLevel string
    Determines how placement groups spread instances. Can only be used when the strategy is set to spread. Can be host or rack. host can only be used for Outpost placement groups. Defaults to rack.
    tags {[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 | PlacementStrategy
    The placement strategy. Can be cluster, partition or spread.
    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 to partition. Valid values are 1 - 7 (default is 2).
    spread_level str
    Determines how placement groups spread instances. Can only be used when the strategy is set to spread. Can be host or rack. host can only be used for Outpost placement groups. Defaults to rack.
    tags 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 or spread.
    name String
    The name of the placement group.
    partitionCount Number
    The number of partitions to create in the placement group. Can only be specified when the strategy is set to partition. Valid values are 1 - 7 (default is 2).
    spreadLevel String
    Determines how placement groups spread instances. Can only be used when the strategy is set to spread. Can be host or rack. host can only be used for Outpost placement groups. Defaults to rack.
    tags 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.
    PlacementGroupId string
    The ID of the placement group.
    TagsAll Dictionary<string, string>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Arn string
    Amazon Resource Name (ARN) of the placement group.
    Id string
    The provider-assigned unique ID for this managed resource.
    PlacementGroupId string
    The ID of the placement group.
    TagsAll map[string]string
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    Amazon Resource Name (ARN) of the placement group.
    id String
    The provider-assigned unique ID for this managed resource.
    placementGroupId String
    The ID of the placement group.
    tagsAll Map<String,String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn string
    Amazon Resource Name (ARN) of the placement group.
    id string
    The provider-assigned unique ID for this managed resource.
    placementGroupId string
    The ID of the placement group.
    tagsAll {[key: string]: string}
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn str
    Amazon Resource Name (ARN) of the placement group.
    id str
    The provider-assigned unique ID for this managed resource.
    placement_group_id str
    The ID of the placement group.
    tags_all Mapping[str, str]
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    Amazon Resource Name (ARN) of the placement group.
    id String
    The provider-assigned unique ID for this managed resource.
    placementGroupId String
    The ID of the placement group.
    tagsAll Map<String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    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.
    The following state arguments are supported:
    Arn string
    Amazon Resource Name (ARN) of the placement group.
    Name string
    The name of the placement group.
    PartitionCount int
    The number of partitions to create in the placement group. Can only be specified when the strategy is set to partition. Valid values are 1 - 7 (default is 2).
    PlacementGroupId string
    The ID of the placement group.
    SpreadLevel string
    Determines how placement groups spread instances. Can only be used when the strategy is set to spread. Can be host or rack. host can only be used for Outpost placement groups. Defaults to rack.
    Strategy string | Pulumi.Aws.Ec2.PlacementStrategy
    The placement strategy. Can be cluster, partition or spread.
    Tags 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.
    TagsAll Dictionary<string, string>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Arn string
    Amazon Resource Name (ARN) of the placement group.
    Name string
    The name of the placement group.
    PartitionCount int
    The number of partitions to create in the placement group. Can only be specified when the strategy is set to partition. Valid values are 1 - 7 (default is 2).
    PlacementGroupId string
    The ID of the placement group.
    SpreadLevel string
    Determines how placement groups spread instances. Can only be used when the strategy is set to spread. Can be host or rack. host can only be used for Outpost placement groups. Defaults to rack.
    Strategy string | PlacementStrategy
    The placement strategy. Can be cluster, partition or spread.
    Tags 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.
    TagsAll map[string]string
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    Amazon Resource Name (ARN) of the placement group.
    name String
    The name of the placement group.
    partitionCount Integer
    The number of partitions to create in the placement group. Can only be specified when the strategy is set to partition. Valid values are 1 - 7 (default is 2).
    placementGroupId String
    The ID of the placement group.
    spreadLevel String
    Determines how placement groups spread instances. Can only be used when the strategy is set to spread. Can be host or rack. host can only be used for Outpost placement groups. Defaults to rack.
    strategy String | PlacementStrategy
    The placement strategy. Can be cluster, partition or spread.
    tags 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.
    tagsAll Map<String,String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn string
    Amazon Resource Name (ARN) of the placement group.
    name string
    The name of the placement group.
    partitionCount number
    The number of partitions to create in the placement group. Can only be specified when the strategy is set to partition. Valid values are 1 - 7 (default is 2).
    placementGroupId string
    The ID of the placement group.
    spreadLevel string
    Determines how placement groups spread instances. Can only be used when the strategy is set to spread. Can be host or rack. host can only be used for Outpost placement groups. Defaults to rack.
    strategy string | PlacementStrategy
    The placement strategy. Can be cluster, partition or spread.
    tags {[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.
    tagsAll {[key: string]: string}
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    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 to partition. Valid values are 1 - 7 (default is 2).
    placement_group_id str
    The ID of the placement group.
    spread_level str
    Determines how placement groups spread instances. Can only be used when the strategy is set to spread. Can be host or rack. host can only be used for Outpost placement groups. Defaults to rack.
    strategy str | PlacementStrategy
    The placement strategy. Can be cluster, partition or spread.
    tags 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.
    tags_all Mapping[str, str]
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    Amazon Resource Name (ARN) of the placement group.
    name String
    The name of the placement group.
    partitionCount Number
    The number of partitions to create in the placement group. Can only be specified when the strategy is set to partition. Valid values are 1 - 7 (default is 2).
    placementGroupId String
    The ID of the placement group.
    spreadLevel String
    Determines how placement groups spread instances. Can only be used when the strategy is set to spread. Can be host or rack. host can only be used for Outpost placement groups. Defaults to rack.
    strategy String | "spread" | "cluster"
    The placement strategy. Can be cluster, partition or spread.
    tags 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.
    tagsAll Map<String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    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.
    PlacementStrategySpread
    spreadA spread placement group places instances on distinct hardware.
    PlacementStrategyCluster
    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.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi