Class PlacementGroup

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.ec2.PlacementGroup
All Implemented Interfaces:
IResource, IPlacementGroup, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:06.231Z") @Stability(Stable) public class PlacementGroup extends Resource implements IPlacementGroup
Defines a placement group.

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

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.ec2.*;
 PlacementGroup placementGroup = PlacementGroup.Builder.create(this, "MyPlacementGroup")
         .partitions(123)
         .placementGroupName("placementGroupName")
         .spreadLevel(PlacementGroupSpreadLevel.HOST)
         .strategy(PlacementGroupStrategy.CLUSTER)
         .build();
 
  • Constructor Details

    • PlacementGroup

      protected PlacementGroup(software.amazon.jsii.JsiiObjectRef objRef)
    • PlacementGroup

      protected PlacementGroup(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • PlacementGroup

      @Stability(Stable) public PlacementGroup(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable PlacementGroupProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • PlacementGroup

      @Stability(Stable) public PlacementGroup(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • fromPlacementGroupName

      @Stability(Stable) @NotNull public static IPlacementGroup fromPlacementGroupName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String placementGroupName)
      Import a PlacementGroup by its arn.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      placementGroupName - This parameter is required.
    • getPlacementGroupName

      @Stability(Stable) @NotNull public String getPlacementGroupName()
      The name of this placement group.
      Specified by:
      getPlacementGroupName in interface IPlacementGroup
    • getPartitions

      @Stability(Stable) @Nullable public Number getPartitions()
      The number of partitions.

      Valid only when Strategy is set to PARTITION.

      Specified by:
      getPartitions in interface IPlacementGroup
    • getSpreadLevel

      @Stability(Stable) @Nullable public PlacementGroupSpreadLevel getSpreadLevel()
      Places instances on distinct hardware.

      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.

      Specified by:
      getSpreadLevel in interface IPlacementGroup
    • getStrategy

      @Stability(Stable) @Nullable public PlacementGroupStrategy getStrategy()
      Which strategy to use when launching instances.
      Specified by:
      getStrategy in interface IPlacementGroup