Show / Hide Table of Contents

Class PlacementGroup

Defines a placement group.

Inheritance
object
Resource
PlacementGroup
Implements
IPlacementGroup
IResource
IPlacementGroupRef
IConstruct
IDependable
IEnvironmentAware
Inherited Members
Resource.IsOwnedResource(IConstruct)
Resource.IsResource(IConstruct)
Resource.ApplyRemovalPolicy(RemovalPolicy)
Resource.GeneratePhysicalName()
Resource.GetResourceArnAttribute(string, IArnComponents)
Resource.GetResourceNameAttribute(string)
Resource.Env
Resource.PhysicalName
Resource.Stack
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class PlacementGroup : Resource, IPlacementGroup, IResource, IPlacementGroupRef, IConstruct, IDependable, IEnvironmentAware
Syntax (vb)
Public Class PlacementGroup Inherits Resource Implements IPlacementGroup, IResource, IPlacementGroupRef, IConstruct, IDependable, IEnvironmentAware
Remarks

Placement groups give you fine-grained control over where your instances are provisioned.

ExampleMetadata: fixture=with-vpc infused

Examples
InstanceType instanceType;


             var pg = new PlacementGroup(this, "test-pg", new PlacementGroupProps {
                 Strategy = PlacementGroupStrategy.SPREAD
             });

             new Instance(this, "Instance", new InstanceProps {
                 Vpc = vpc,
                 InstanceType = instanceType,
                 MachineImage = MachineImage.LatestAmazonLinux2023(),
                 PlacementGroup = pg
             });

Synopsis

Constructors

PlacementGroup(Construct, string, IPlacementGroupProps?)

Defines a placement group.

Properties

PROPERTY_INJECTION_ID

Uniquely identifies this class.

Partitions

The number of partitions.

PlacementGroupName

The name of this placement group.

PlacementGroupRef

A reference to a PlacementGroup resource.

SpreadLevel

Places instances on distinct hardware.

Strategy

Which strategy to use when launching instances.

Methods

FromPlacementGroupName(Construct, string, string)

Import a PlacementGroup by its arn.

Constructors

PlacementGroup(Construct, string, IPlacementGroupProps?)

Defines a placement group.

public PlacementGroup(Construct scope, string id, IPlacementGroupProps? props = null)
Parameters
scope Construct
id string
props IPlacementGroupProps
Remarks

Placement groups give you fine-grained control over where your instances are provisioned.

ExampleMetadata: fixture=with-vpc infused

Examples
InstanceType instanceType;


             var pg = new PlacementGroup(this, "test-pg", new PlacementGroupProps {
                 Strategy = PlacementGroupStrategy.SPREAD
             });

             new Instance(this, "Instance", new InstanceProps {
                 Vpc = vpc,
                 InstanceType = instanceType,
                 MachineImage = MachineImage.LatestAmazonLinux2023(),
                 PlacementGroup = pg
             });

Properties

PROPERTY_INJECTION_ID

Uniquely identifies this class.

public static string PROPERTY_INJECTION_ID { get; }
Property Value

string

Remarks

Placement groups give you fine-grained control over where your instances are provisioned.

ExampleMetadata: fixture=with-vpc infused

Partitions

The number of partitions.

public virtual double? Partitions { get; }
Property Value

double?

Remarks

Valid only when Strategy is set to PARTITION.

PlacementGroupName

The name of this placement group.

public virtual string PlacementGroupName { get; }
Property Value

string

Remarks

Placement groups give you fine-grained control over where your instances are provisioned.

ExampleMetadata: fixture=with-vpc infused

PlacementGroupRef

A reference to a PlacementGroup resource.

public virtual IPlacementGroupReference PlacementGroupRef { get; }
Property Value

IPlacementGroupReference

Remarks

Placement groups give you fine-grained control over where your instances are provisioned.

ExampleMetadata: fixture=with-vpc infused

SpreadLevel

Places instances on distinct hardware.

public virtual PlacementGroupSpreadLevel? SpreadLevel { get; }
Property Value

PlacementGroupSpreadLevel?

Remarks

Spread placement groups are recommended for applications that have a small number of critical instances that should be kept separate from each other. Launching instances in a spread level placement group reduces the risk of simultaneous failures that might occur when instances share the same equipment. Spread level placement groups provide access to distinct hardware, and are therefore suitable for mixing instance types or launching instances over time. If you start or launch an instance in a spread placement group and there is insufficient unique hardware to fulfill the request, the request fails. Amazon EC2 makes more distinct hardware available over time, so you can try your request again later. Placement groups can spread instances across racks or hosts. You can use host level spread placement groups only with AWS Outposts.

Strategy

Which strategy to use when launching instances.

public virtual PlacementGroupStrategy? Strategy { get; }
Property Value

PlacementGroupStrategy?

Remarks

Placement groups give you fine-grained control over where your instances are provisioned.

ExampleMetadata: fixture=with-vpc infused

Methods

FromPlacementGroupName(Construct, string, string)

Import a PlacementGroup by its arn.

public static IPlacementGroup FromPlacementGroupName(Construct scope, string id, string placementGroupName)
Parameters
scope Construct
id string
placementGroupName string
Returns

IPlacementGroup

Remarks

Placement groups give you fine-grained control over where your instances are provisioned.

ExampleMetadata: fixture=with-vpc infused

Implements

IPlacementGroup
IResource
IPlacementGroupRef
Constructs.IConstruct
Constructs.IDependable
IEnvironmentAware
Back to top Generated by DocFX