Class: AWSCDK::ECS::FargateTaskDefinitionProps

Inherits:
CommonTaskDefinitionProps
  • Object
show all
Defined in:
ecs/fargate_task_definition_props.rb

Overview

The properties for a task definition.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enable_fault_injection: nil, execution_role: nil, family: nil, proxy_configuration: nil, task_role: nil, volumes: nil, cpu: nil, ephemeral_storage_gib: nil, memory_limit_mib: nil, pid_mode: nil, runtime_platform: nil) ⇒ FargateTaskDefinitionProps

Returns a new instance of FargateTaskDefinitionProps.

Parameters:

  • enable_fault_injection (Boolean, nil) (defaults to: nil)

    Enables fault injection and allows for fault injection requests to be accepted from the task's containers.

  • execution_role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    The name of the IAM task execution role that grants the ECS agent permission to call AWS APIs on your behalf.

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

    The name of a family that this task definition is registered to.

  • proxy_configuration (AWSCDK::ECS::ProxyConfiguration, nil) (defaults to: nil)

    The configuration details for the App Mesh proxy.

  • task_role (AWSCDK::IAM::IRole, nil) (defaults to: nil)

    The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.

  • volumes (Array<AWSCDK::ECS::Volume>, nil) (defaults to: nil)

    The list of volume definitions for the task.

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

    The number of cpu units used by the task.

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

    The amount (in GiB) of ephemeral storage to be allocated to the task.

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

    The amount (in MiB) of memory used by the task.

  • pid_mode (AWSCDK::ECS::PidMode, nil) (defaults to: nil)

    The process namespace to use for the containers in the task.

  • runtime_platform (AWSCDK::ECS::RuntimePlatform, nil) (defaults to: nil)

    The operating system that your task definitions are running on.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'ecs/fargate_task_definition_props.rb', line 18

def initialize(enable_fault_injection: nil, execution_role: nil, family: nil, proxy_configuration: nil, task_role: nil, volumes: nil, cpu: nil, ephemeral_storage_gib: nil, memory_limit_mib: nil, pid_mode: nil, runtime_platform: nil)
  @enable_fault_injection = enable_fault_injection
  Jsii::Type.check_type(@enable_fault_injection, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableFaultInjection") unless @enable_fault_injection.nil?
  @execution_role = execution_role
  Jsii::Type.check_type(@execution_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "executionRole") unless @execution_role.nil?
  @family = family
  Jsii::Type.check_type(@family, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "family") unless @family.nil?
  @proxy_configuration = proxy_configuration
  Jsii::Type.check_type(@proxy_configuration, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlByb3h5Q29uZmlndXJhdGlvbiJ9")), "proxyConfiguration") unless @proxy_configuration.nil?
  @task_role = task_role
  Jsii::Type.check_type(@task_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "taskRole") unless @task_role.nil?
  @volumes = volumes.is_a?(Array) ? volumes.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ECS::Volume.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : volumes
  Jsii::Type.check_type(@volumes, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuVm9sdW1lIn0sImtpbmQiOiJhcnJheSJ9fQ==")), "volumes") unless @volumes.nil?
  @cpu = cpu
  Jsii::Type.check_type(@cpu, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "cpu") unless @cpu.nil?
  @ephemeral_storage_gib = ephemeral_storage_gib
  Jsii::Type.check_type(@ephemeral_storage_gib, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "ephemeralStorageGiB") unless @ephemeral_storage_gib.nil?
  @memory_limit_mib = memory_limit_mib
  Jsii::Type.check_type(@memory_limit_mib, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "memoryLimitMiB") unless @memory_limit_mib.nil?
  @pid_mode = pid_mode
  Jsii::Type.check_type(@pid_mode, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlBpZE1vZGUifQ==")), "pidMode") unless @pid_mode.nil?
  @runtime_platform = runtime_platform.is_a?(Hash) ? ::AWSCDK::ECS::RuntimePlatform.new(**runtime_platform.transform_keys(&:to_sym)) : runtime_platform
  Jsii::Type.check_type(@runtime_platform, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlJ1bnRpbWVQbGF0Zm9ybSJ9")), "runtimePlatform") unless @runtime_platform.nil?
end

Instance Attribute Details

#cpuNumeric? (readonly)

Note:

Default: 256

The number of cpu units used by the task.

For tasks using the Fargate launch type, this field is required and you must use one of the following values, which determines your range of valid values for the memory parameter:

256 (.25 vCPU) - Available memory values: 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB)

512 (.5 vCPU) - Available memory values: 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB)

1024 (1 vCPU) - Available memory values: 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB)

2048 (2 vCPU) - Available memory values: Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB)

4096 (4 vCPU) - Available memory values: Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB)

8192 (8 vCPU) - Available memory values: Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB)

16384 (16 vCPU) - Available memory values: Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB)

Note: For windows platforms, this field is not enforced at runtime. However, it is still required as it is used to determine the instance type and size that tasks run on.

Returns:

  • (Numeric, nil)


107
108
109
# File 'ecs/fargate_task_definition_props.rb', line 107

def cpu
  @cpu
end

#enable_fault_injectionBoolean? (readonly)

Note:

Default: undefined - ECS default setting is false

Enables fault injection and allows for fault injection requests to be accepted from the task's containers.

Fault injection only works with tasks using the NetworkMode.AWS_VPC or NetworkMode.HOST network modes.

Returns:

  • (Boolean, nil)


49
50
51
# File 'ecs/fargate_task_definition_props.rb', line 49

def enable_fault_injection
  @enable_fault_injection
end

#ephemeral_storage_gibNumeric? (readonly)

Note:

Default: 20

The amount (in GiB) of ephemeral storage to be allocated to the task.

The maximum supported value is 200 GiB.

NOTE: This parameter is only supported for tasks hosted on AWS Fargate using platform version 1.4.0 or later.

Returns:

  • (Numeric, nil)


116
117
118
# File 'ecs/fargate_task_definition_props.rb', line 116

def ephemeral_storage_gib
  @ephemeral_storage_gib
end

#execution_roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: - An execution role will be automatically created if you use ECR images in your task definition.

The name of the IAM task execution role that grants the ECS agent permission to call AWS APIs on your behalf.

The role will be used to retrieve container images from ECR and create CloudWatch log groups.

Returns:



56
57
58
# File 'ecs/fargate_task_definition_props.rb', line 56

def execution_role
  @execution_role
end

#familyString? (readonly)

Note:

Default: - Automatically generated name.

The name of a family that this task definition is registered to.

A family groups multiple versions of a task definition.

Returns:

  • (String, nil)


63
64
65
# File 'ecs/fargate_task_definition_props.rb', line 63

def family
  @family
end

#memory_limit_mibNumeric? (readonly)

Note:

Default: 512

The amount (in MiB) of memory used by the task.

For tasks using the Fargate launch type, this field is required and you must use one of the following values, which determines your range of valid values for the cpu parameter:

512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU)

1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU)

2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU)

Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU)

Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU)

Between 16384 (16 GB) and 61440 (60 GB) in increments of 4096 (4 GB) - Available cpu values: 8192 (8 vCPU)

Between 32768 (32 GB) and 122880 (120 GB) in increments of 8192 (8 GB) - Available cpu values: 16384 (16 vCPU)

Note: For windows platforms, this field is not enforced at runtime. However, it is still required as it is used to determine the instance type and size that tasks run on.

Returns:

  • (Numeric, nil)


141
142
143
# File 'ecs/fargate_task_definition_props.rb', line 141

def memory_limit_mib
  @memory_limit_mib
end

#pid_modeAWSCDK::ECS::PidMode? (readonly)

Note:

Default: - PidMode used by the task is not specified

The process namespace to use for the containers in the task.

Only supported for tasks that are hosted on AWS Fargate if the tasks are using platform version 1.4.0 or later (Linux). Only the TASK option is supported for Linux-based Fargate containers. Not supported in Windows containers. If pidMode is specified for a Fargate task, then runtimePlatform.operatingSystemFamily must also be specified. For more information, see Task Definition Parameters.

Returns:



153
154
155
# File 'ecs/fargate_task_definition_props.rb', line 153

def pid_mode
  @pid_mode
end

#proxy_configurationAWSCDK::ECS::ProxyConfiguration? (readonly)

Note:

Default: - No proxy configuration.

The configuration details for the App Mesh proxy.



68
69
70
# File 'ecs/fargate_task_definition_props.rb', line 68

def proxy_configuration
  @proxy_configuration
end

#runtime_platformAWSCDK::ECS::RuntimePlatform? (readonly)

Note:

Default: - Undefined.

The operating system that your task definitions are running on.

A runtimePlatform is supported only for tasks using the Fargate launch type.



160
161
162
# File 'ecs/fargate_task_definition_props.rb', line 160

def runtime_platform
  @runtime_platform
end

#task_roleAWSCDK::IAM::IRole? (readonly)

Note:

Default: - A task role is automatically created for you.

The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.

Returns:



73
74
75
# File 'ecs/fargate_task_definition_props.rb', line 73

def task_role
  @task_role
end

#volumesArray<AWSCDK::ECS::Volume>? (readonly)

Note:

Default: - No volumes are passed to the Docker daemon on a container instance.

The list of volume definitions for the task.

For more information, see Task Definition Parameter Volumes.

Returns:



81
82
83
# File 'ecs/fargate_task_definition_props.rb', line 81

def volumes
  @volumes
end

Class Method Details

.jsii_propertiesObject



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'ecs/fargate_task_definition_props.rb', line 162

def self.jsii_properties
  {
    :enable_fault_injection => "enableFaultInjection",
    :execution_role => "executionRole",
    :family => "family",
    :proxy_configuration => "proxyConfiguration",
    :task_role => "taskRole",
    :volumes => "volumes",
    :cpu => "cpu",
    :ephemeral_storage_gib => "ephemeralStorageGiB",
    :memory_limit_mib => "memoryLimitMiB",
    :pid_mode => "pidMode",
    :runtime_platform => "runtimePlatform",
  }
end

Instance Method Details

#to_jsiiObject



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'ecs/fargate_task_definition_props.rb', line 178

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "enableFaultInjection" => @enable_fault_injection,
    "executionRole" => @execution_role,
    "family" => @family,
    "proxyConfiguration" => @proxy_configuration,
    "taskRole" => @task_role,
    "volumes" => @volumes,
    "cpu" => @cpu,
    "ephemeralStorageGiB" => @ephemeral_storage_gib,
    "memoryLimitMiB" => @memory_limit_mib,
    "pidMode" => @pid_mode,
    "runtimePlatform" => @runtime_platform,
  })
  result.compact
end