Class: AWSCDK::EC2::PlacementGroupProps

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ec2/placement_group_props.rb

Overview

Props for a PlacementGroup.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(partitions: nil, placement_group_name: nil, spread_level: nil, strategy: nil) ⇒ PlacementGroupProps

Returns a new instance of PlacementGroupProps.

Parameters:

  • partitions (Numeric, nil) (defaults to: nil)

    The number of partitions.

  • placement_group_name (String, nil) (defaults to: nil)

    the name of this placement group.

  • spread_level (AWSCDK::EC2::PlacementGroupSpreadLevel, nil) (defaults to: nil)

    Places instances on distinct hardware.

  • strategy (AWSCDK::EC2::PlacementGroupStrategy, nil) (defaults to: nil)

    Which strategy to use when launching instances.



11
12
13
14
15
16
17
18
19
20
# File 'ec2/placement_group_props.rb', line 11

def initialize(partitions: nil, placement_group_name: nil, spread_level: nil, strategy: nil)
  @partitions = partitions
  Jsii::Type.check_type(@partitions, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "partitions") unless @partitions.nil?
  @placement_group_name = placement_group_name
  Jsii::Type.check_type(@placement_group_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "placementGroupName") unless @placement_group_name.nil?
  @spread_level = spread_level
  Jsii::Type.check_type(@spread_level, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlBsYWNlbWVudEdyb3VwU3ByZWFkTGV2ZWwifQ==")), "spreadLevel") unless @spread_level.nil?
  @strategy = strategy
  Jsii::Type.check_type(@strategy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWMyLlBsYWNlbWVudEdyb3VwU3RyYXRlZ3kifQ==")), "strategy") unless @strategy.nil?
end

Instance Attribute Details

#partitionsNumeric? (readonly)

Note:

Default: 0

The number of partitions.

Valid only when Strategy is set to partition.

Returns:

  • (Numeric, nil)


28
29
30
# File 'ec2/placement_group_props.rb', line 28

def partitions
  @partitions
end

#placement_group_nameString? (readonly)

Note:

Default: - generated by CFN

the name of this placement group.

Returns:

  • (String, nil)


33
34
35
# File 'ec2/placement_group_props.rb', line 33

def placement_group_name
  @placement_group_name
end

#spread_levelAWSCDK::EC2::PlacementGroupSpreadLevel? (readonly)

Note:

Default: - no spread level

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.



50
51
52
# File 'ec2/placement_group_props.rb', line 50

def spread_level
  @spread_level
end

#strategyAWSCDK::EC2::PlacementGroupStrategy? (readonly)

Note:

Default: - PlacementGroupStrategy.PARTITION if partitions is defined, CLUSTER otherwise

Which strategy to use when launching instances.



55
56
57
# File 'ec2/placement_group_props.rb', line 55

def strategy
  @strategy
end

Class Method Details

.jsii_propertiesObject



57
58
59
60
61
62
63
64
# File 'ec2/placement_group_props.rb', line 57

def self.jsii_properties
  {
    :partitions => "partitions",
    :placement_group_name => "placementGroupName",
    :spread_level => "spreadLevel",
    :strategy => "strategy",
  }
end

Instance Method Details

#to_jsiiObject



66
67
68
69
70
71
72
73
74
75
# File 'ec2/placement_group_props.rb', line 66

def to_jsii
  result = {}
  result.merge!({
    "partitions" => @partitions,
    "placementGroupName" => @placement_group_name,
    "spreadLevel" => @spread_level,
    "strategy" => @strategy,
  })
  result.compact
end