Class: AWSCDK::ECS::CfnService::PlacementStrategyProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ecs/cfn_service.rb

Overview

The task placement strategy for a task or service.

For more information, see Task placement strategies in the Amazon Elastic Container Service Developer Guide .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, field: nil) ⇒ PlacementStrategyProperty

Returns a new instance of PlacementStrategyProperty.

Parameters:

  • type (String)

    The type of placement strategy.

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

    The field to apply the placement strategy against.



2302
2303
2304
2305
2306
2307
# File 'ecs/cfn_service.rb', line 2302

def initialize(type:, field: nil)
  @type = type
  Jsii::Type.check_type(@type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "type")
  @field = field
  Jsii::Type.check_type(@field, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "field") unless @field.nil?
end

Instance Attribute Details

#fieldString? (readonly)

The field to apply the placement strategy against.

For the spread placement strategy, valid values are instance_id (or host , which has the same effect), or any platform or custom attribute that's applied to a container instance, such as attribute:ecs.availability-zone . For the binpack placement strategy, valid values are cpu and memory . For the random placement strategy, this field is not used.



2322
2323
2324
# File 'ecs/cfn_service.rb', line 2322

def field
  @field
end

#typeString (readonly)

The type of placement strategy.

The random placement strategy randomly places tasks on available candidates. The spread placement strategy spreads placement across available candidates evenly based on the field parameter. The binpack strategy places tasks on available candidates that have the least available amount of the resource that's specified with the field parameter. For example, if you binpack on memory, a task is placed on the instance with the least amount of remaining memory but still enough to run the task.



2315
2316
2317
# File 'ecs/cfn_service.rb', line 2315

def type
  @type
end

Class Method Details

.jsii_propertiesObject



2324
2325
2326
2327
2328
2329
# File 'ecs/cfn_service.rb', line 2324

def self.jsii_properties
  {
    :type => "type",
    :field => "field",
  }
end

Instance Method Details

#to_jsiiObject



2331
2332
2333
2334
2335
2336
2337
2338
# File 'ecs/cfn_service.rb', line 2331

def to_jsii
  result = {}
  result.merge!({
    "type" => @type,
    "field" => @field,
  })
  result.compact
end