Class: AWSCDK::ECS::TaskDefinitionProps
- Inherits:
-
CommonTaskDefinitionProps
- Object
- CommonTaskDefinitionProps
- AWSCDK::ECS::TaskDefinitionProps
- Defined in:
- ecs/task_definition_props.rb
Overview
The properties for task definitions.
Instance Attribute Summary collapse
-
#compatibility ⇒ AWSCDK::ECS::Compatibility
readonly
The task launch type compatibility requirement.
-
#cpu ⇒ String?
readonly
The number of cpu units used by the task.
-
#enable_fault_injection ⇒ Boolean?
readonly
Enables fault injection and allows for fault injection requests to be accepted from the task's containers.
-
#ephemeral_storage_gib ⇒ Numeric?
readonly
The amount (in GiB) of ephemeral storage to be allocated to the task.
-
#execution_role ⇒ AWSCDK::IAM::IRole?
readonly
The name of the IAM task execution role that grants the ECS agent permission to call AWS APIs on your behalf.
-
#family ⇒ String?
readonly
The name of a family that this task definition is registered to.
-
#inference_accelerators ⇒ Array<AWSCDK::ECS::InferenceAccelerator>?
readonly
deprecated
Deprecated.
ECS TaskDefinition's inferenceAccelerator is EOL since April 2024
-
#ipc_mode ⇒ AWSCDK::ECS::IpcMode?
readonly
The IPC resource namespace to use for the containers in the task.
-
#memory_mib ⇒ String?
readonly
The amount (in MiB) of memory used by the task.
-
#network_mode ⇒ AWSCDK::ECS::NetworkMode?
readonly
The networking mode to use for the containers in the task.
-
#pid_mode ⇒ AWSCDK::ECS::PidMode?
readonly
The process namespace to use for the containers in the task.
-
#placement_constraints ⇒ Array<AWSCDK::ECS::PlacementConstraint>?
readonly
The placement constraints to use for tasks in the service.
-
#proxy_configuration ⇒ AWSCDK::ECS::ProxyConfiguration?
readonly
The configuration details for the App Mesh proxy.
-
#runtime_platform ⇒ AWSCDK::ECS::RuntimePlatform?
readonly
The operating system that your task definitions are running on.
-
#task_role ⇒ AWSCDK::IAM::IRole?
readonly
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>?
readonly
The list of volume definitions for the task.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(enable_fault_injection: nil, execution_role: nil, family: nil, proxy_configuration: nil, task_role: nil, volumes: nil, compatibility:, cpu: nil, ephemeral_storage_gib: nil, inference_accelerators: nil, ipc_mode: nil, memory_mib: nil, network_mode: nil, pid_mode: nil, placement_constraints: nil, runtime_platform: nil) ⇒ TaskDefinitionProps
constructor
A new instance of TaskDefinitionProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(enable_fault_injection: nil, execution_role: nil, family: nil, proxy_configuration: nil, task_role: nil, volumes: nil, compatibility:, cpu: nil, ephemeral_storage_gib: nil, inference_accelerators: nil, ipc_mode: nil, memory_mib: nil, network_mode: nil, pid_mode: nil, placement_constraints: nil, runtime_platform: nil) ⇒ TaskDefinitionProps
Returns a new instance of TaskDefinitionProps.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'ecs/task_definition_props.rb', line 23 def initialize(enable_fault_injection: nil, execution_role: nil, family: nil, proxy_configuration: nil, task_role: nil, volumes: nil, compatibility:, cpu: nil, ephemeral_storage_gib: nil, inference_accelerators: nil, ipc_mode: nil, memory_mib: nil, network_mode: nil, pid_mode: nil, placement_constraints: 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? @compatibility = compatibility Jsii::Type.check_type(@compatibility, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNvbXBhdGliaWxpdHkifQ==")), "compatibility") @cpu = cpu Jsii::Type.check_type(@cpu, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "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? @inference_accelerators = inference_accelerators.is_a?(Array) ? inference_accelerators.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::ECS::InferenceAccelerator.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : inference_accelerators Jsii::Type.check_type(@inference_accelerators, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuSW5mZXJlbmNlQWNjZWxlcmF0b3IifSwia2luZCI6ImFycmF5In19")), "inferenceAccelerators") unless @inference_accelerators.nil? @ipc_mode = ipc_mode Jsii::Type.check_type(@ipc_mode, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLklwY01vZGUifQ==")), "ipcMode") unless @ipc_mode.nil? @memory_mib = memory_mib Jsii::Type.check_type(@memory_mib, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "memoryMiB") unless @memory_mib.nil? @network_mode = network_mode Jsii::Type.check_type(@network_mode, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLk5ldHdvcmtNb2RlIn0=")), "networkMode") unless @network_mode.nil? @pid_mode = pid_mode Jsii::Type.check_type(@pid_mode, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLlBpZE1vZGUifQ==")), "pidMode") unless @pid_mode.nil? @placement_constraints = placement_constraints Jsii::Type.check_type(@placement_constraints, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuUGxhY2VtZW50Q29uc3RyYWludCJ9LCJraW5kIjoiYXJyYXkifX0=")), "placementConstraints") unless @placement_constraints.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
#compatibility ⇒ AWSCDK::ECS::Compatibility (readonly)
The task launch type compatibility requirement.
100 101 102 |
# File 'ecs/task_definition_props.rb', line 100 def compatibility @compatibility end |
#cpu ⇒ String? (readonly)
Default: - CPU units are not specified.
The number of cpu units used by the task.
If you are using the EC2 launch type, this field is optional and any value can be used. If you are 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)
123 124 125 |
# File 'ecs/task_definition_props.rb', line 123 def cpu @cpu end |
#enable_fault_injection ⇒ Boolean? (readonly)
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.
64 65 66 |
# File 'ecs/task_definition_props.rb', line 64 def enable_fault_injection @enable_fault_injection end |
#ephemeral_storage_gib ⇒ Numeric? (readonly)
Default: - Undefined, in which case, the task will receive 20GiB ephemeral storage.
The amount (in GiB) of ephemeral storage to be allocated to the task.
Only supported in Fargate platform version 1.4.0 or later.
130 131 132 |
# File 'ecs/task_definition_props.rb', line 130 def ephemeral_storage_gib @ephemeral_storage_gib end |
#execution_role ⇒ AWSCDK::IAM::IRole? (readonly)
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.
71 72 73 |
# File 'ecs/task_definition_props.rb', line 71 def execution_role @execution_role end |
#family ⇒ String? (readonly)
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.
78 79 80 |
# File 'ecs/task_definition_props.rb', line 78 def family @family end |
#inference_accelerators ⇒ Array<AWSCDK::ECS::InferenceAccelerator>? (readonly)
ECS TaskDefinition's inferenceAccelerator is EOL since April 2024
Default: - No inference accelerators.
The inference accelerators to use for the containers in the task.
Not supported in Fargate.
138 139 140 |
# File 'ecs/task_definition_props.rb', line 138 def inference_accelerators @inference_accelerators end |
#ipc_mode ⇒ AWSCDK::ECS::IpcMode? (readonly)
Default: - IpcMode used by the task is not specified
The IPC resource namespace to use for the containers in the task.
Not supported in Fargate and Windows containers.
145 146 147 |
# File 'ecs/task_definition_props.rb', line 145 def ipc_mode @ipc_mode end |
#memory_mib ⇒ String? (readonly)
Default: - Memory used by task is not specified.
The amount (in MiB) of memory used by the task.
If using the EC2 launch type, this field is optional and any value can be used. If 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)
168 169 170 |
# File 'ecs/task_definition_props.rb', line 168 def memory_mib @memory_mib end |
#network_mode ⇒ AWSCDK::ECS::NetworkMode? (readonly)
Default: - NetworkMode.Bridge for EC2 & External tasks, AwsVpc for Fargate tasks.
The networking mode to use for the containers in the task.
On Fargate, the only supported networking mode is AwsVpc.
175 176 177 |
# File 'ecs/task_definition_props.rb', line 175 def network_mode @network_mode end |
#pid_mode ⇒ AWSCDK::ECS::PidMode? (readonly)
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.
187 188 189 |
# File 'ecs/task_definition_props.rb', line 187 def pid_mode @pid_mode end |
#placement_constraints ⇒ Array<AWSCDK::ECS::PlacementConstraint>? (readonly)
Default: - No placement constraints.
The placement constraints to use for tasks in the service.
You can specify a maximum of 10 constraints per task (this limit includes constraints in the task definition and those specified at run time).
Not supported in Fargate.
197 198 199 |
# File 'ecs/task_definition_props.rb', line 197 def placement_constraints @placement_constraints end |
#proxy_configuration ⇒ AWSCDK::ECS::ProxyConfiguration? (readonly)
Default: - No proxy configuration.
The configuration details for the App Mesh proxy.
83 84 85 |
# File 'ecs/task_definition_props.rb', line 83 def proxy_configuration @proxy_configuration end |
#runtime_platform ⇒ AWSCDK::ECS::RuntimePlatform? (readonly)
Default: - Undefined.
The operating system that your task definitions are running on.
A runtimePlatform is supported only for tasks using the Fargate launch type.
204 205 206 |
# File 'ecs/task_definition_props.rb', line 204 def runtime_platform @runtime_platform end |
#task_role ⇒ AWSCDK::IAM::IRole? (readonly)
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.
88 89 90 |
# File 'ecs/task_definition_props.rb', line 88 def task_role @task_role end |
#volumes ⇒ Array<AWSCDK::ECS::Volume>? (readonly)
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.
96 97 98 |
# File 'ecs/task_definition_props.rb', line 96 def volumes @volumes end |
Class Method Details
.jsii_properties ⇒ Object
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
# File 'ecs/task_definition_props.rb', line 206 def self.jsii_properties { :enable_fault_injection => "enableFaultInjection", :execution_role => "executionRole", :family => "family", :proxy_configuration => "proxyConfiguration", :task_role => "taskRole", :volumes => "volumes", :compatibility => "compatibility", :cpu => "cpu", :ephemeral_storage_gib => "ephemeralStorageGiB", :inference_accelerators => "inferenceAccelerators", :ipc_mode => "ipcMode", :memory_mib => "memoryMiB", :network_mode => "networkMode", :pid_mode => "pidMode", :placement_constraints => "placementConstraints", :runtime_platform => "runtimePlatform", } end |
Instance Method Details
#to_jsii ⇒ Object
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'ecs/task_definition_props.rb', line 227 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, "compatibility" => @compatibility, "cpu" => @cpu, "ephemeralStorageGiB" => @ephemeral_storage_gib, "inferenceAccelerators" => @inference_accelerators, "ipcMode" => @ipc_mode, "memoryMiB" => @memory_mib, "networkMode" => @network_mode, "pidMode" => @pid_mode, "placementConstraints" => @placement_constraints, "runtimePlatform" => @runtime_platform, }) result.compact end |