Class: AWSCDK::Batch::ECSEC2ContainerDefinitionProps
- Inherits:
-
ECSContainerDefinitionProps
- Object
- ECSContainerDefinitionProps
- AWSCDK::Batch::ECSEC2ContainerDefinitionProps
- Defined in:
- batch/ecsec2_container_definition_props.rb
Overview
Props to configure an EcsEc2ContainerDefinition.
Instance Attribute Summary collapse
-
#command ⇒ Array<String>?
readonly
The command that's passed to the container.
-
#cpu ⇒ Numeric
readonly
The number of vCPUs reserved for the container.
-
#enable_execute_command ⇒ Boolean?
readonly
Determines whether execute command functionality is turned on for this task.
-
#environment ⇒ Hash{String => String}?
readonly
The environment variables to pass to a container.
-
#execution_role ⇒ AWSCDK::IAM::IRole?
readonly
The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.
-
#gpu ⇒ Numeric?
readonly
The number of physical GPUs to reserve for the container.
-
#image ⇒ AWSCDK::ECS::ContainerImage
readonly
The image that this container will run.
-
#job_role ⇒ AWSCDK::IAM::IRole?
readonly
The role that the container can assume.
-
#linux_parameters ⇒ AWSCDK::Batch::LinuxParameters?
readonly
Linux-specific modifications that are applied to the container, such as details for device mappings.
-
#logging ⇒ AWSCDK::ECS::LogDriver?
readonly
The loging configuration for this Job.
-
#memory ⇒ AWSCDK::Size
readonly
The memory hard limit present to the container.
-
#privileged ⇒ Boolean?
readonly
When this parameter is true, the container is given elevated permissions on the host container instance (similar to the root user).
-
#readonly_root_filesystem ⇒ Boolean?
readonly
Gives the container readonly access to its root filesystem.
-
#secrets ⇒ Hash{String => AWSCDK::Batch::Secret}?
readonly
A map from environment variable names to the secrets for the container.
-
#ulimits ⇒ Array<AWSCDK::Batch::Ulimit>?
readonly
Limits to set for the user this docker container will run as.
-
#user ⇒ String?
readonly
The user name to use inside the container.
-
#volumes ⇒ Array<AWSCDK::Batch::ECSVolume>?
readonly
The volumes to mount to this container.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cpu:, image:, memory:, command: nil, enable_execute_command: nil, environment: nil, execution_role: nil, job_role: nil, linux_parameters: nil, logging: nil, readonly_root_filesystem: nil, secrets: nil, user: nil, volumes: nil, gpu: nil, privileged: nil, ulimits: nil) ⇒ ECSEC2ContainerDefinitionProps
constructor
A new instance of ECSEC2ContainerDefinitionProps.
- #to_jsii ⇒ Object
Constructor Details
#initialize(cpu:, image:, memory:, command: nil, enable_execute_command: nil, environment: nil, execution_role: nil, job_role: nil, linux_parameters: nil, logging: nil, readonly_root_filesystem: nil, secrets: nil, user: nil, volumes: nil, gpu: nil, privileged: nil, ulimits: nil) ⇒ ECSEC2ContainerDefinitionProps
Returns a new instance of ECSEC2ContainerDefinitionProps.
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 57 58 59 |
# File 'batch/ecsec2_container_definition_props.rb', line 24 def initialize(cpu:, image:, memory:, command: nil, enable_execute_command: nil, environment: nil, execution_role: nil, job_role: nil, linux_parameters: nil, logging: nil, readonly_root_filesystem: nil, secrets: nil, user: nil, volumes: nil, gpu: nil, privileged: nil, ulimits: nil) @cpu = cpu Jsii::Type.check_type(@cpu, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "cpu") @image = image Jsii::Type.check_type(@image, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkNvbnRhaW5lckltYWdlIn0=")), "image") @memory = memory Jsii::Type.check_type(@memory, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5TaXplIn0=")), "memory") @command = command Jsii::Type.check_type(@command, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "command") unless @command.nil? @enable_execute_command = enable_execute_command Jsii::Type.check_type(@enable_execute_command, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "enableExecuteCommand") unless @enable_execute_command.nil? @environment = environment Jsii::Type.check_type(@environment, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoibWFwIn19")), "environment") unless @environment.nil? @execution_role = execution_role Jsii::Type.check_type(@execution_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "executionRole") unless @execution_role.nil? @job_role = job_role Jsii::Type.check_type(@job_role, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklSb2xlIn0=")), "jobRole") unless @job_role.nil? @linux_parameters = linux_parameters Jsii::Type.check_type(@linux_parameters, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guTGludXhQYXJhbWV0ZXJzIn0=")), "linuxParameters") unless @linux_parameters.nil? @logging = logging Jsii::Type.check_type(@logging, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZWNzLkxvZ0RyaXZlciJ9")), "logging") unless @logging.nil? @readonly_root_filesystem = readonly_root_filesystem Jsii::Type.check_type(@readonly_root_filesystem, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "readonlyRootFilesystem") unless @readonly_root_filesystem.nil? @secrets = secrets Jsii::Type.check_type(@secrets, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5TZWNyZXQifSwia2luZCI6Im1hcCJ9fQ==")), "secrets") unless @secrets.nil? @user = user Jsii::Type.check_type(@user, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "user") unless @user.nil? @volumes = volumes Jsii::Type.check_type(@volumes, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5FY3NWb2x1bWUifSwia2luZCI6ImFycmF5In19")), "volumes") unless @volumes.nil? @gpu = gpu Jsii::Type.check_type(@gpu, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "gpu") unless @gpu.nil? @privileged = privileged Jsii::Type.check_type(@privileged, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "privileged") unless @privileged.nil? @ulimits = ulimits.is_a?(Array) ? ulimits.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::Batch::Ulimit.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : ulimits Jsii::Type.check_type(@ulimits, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5VbGltaXQifSwia2luZCI6ImFycmF5In19")), "ulimits") unless @ulimits.nil? end |
Instance Attribute Details
#command ⇒ Array<String>? (readonly)
Default: - no command
The command that's passed to the container.
84 85 86 |
# File 'batch/ecsec2_container_definition_props.rb', line 84 def command @command end |
#cpu ⇒ Numeric (readonly)
The number of vCPUs reserved for the container.
Each vCPU is equivalent to 1,024 CPU shares. For containers running on EC2 resources, you must specify at least one vCPU.
67 68 69 |
# File 'batch/ecsec2_container_definition_props.rb', line 67 def cpu @cpu end |
#enable_execute_command ⇒ Boolean? (readonly)
Default: undefined - AWS Batch default is false
Determines whether execute command functionality is turned on for this task.
If true, execute command functionality is turned on all the containers in the task.
This allows you to use ECS Exec to access containers interactively. When enabled, a job role with required SSM permissions will be created automatically if no job role is provided. If a job role is alreadyprovided, the required permissions will be added to it.
96 97 98 |
# File 'batch/ecsec2_container_definition_props.rb', line 96 def enable_execute_command @enable_execute_command end |
#environment ⇒ Hash{String => String}? (readonly)
Default: - no environment variables
The environment variables to pass to a container.
Cannot start with AWS_BATCH.
We don't recommend using plaintext environment variables for sensitive information, such as credential data.
104 105 106 |
# File 'batch/ecsec2_container_definition_props.rb', line 104 def environment @environment end |
#execution_role ⇒ AWSCDK::IAM::IRole? (readonly)
Default: - a Role will be created
The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.
110 111 112 |
# File 'batch/ecsec2_container_definition_props.rb', line 110 def execution_role @execution_role end |
#gpu ⇒ Numeric? (readonly)
Default: - no gpus
The number of physical GPUs to reserve for the container.
Make sure that the number of GPUs reserved for all containers in a job doesn't exceed the number of available GPUs on the compute resource that the job is launched on.
160 161 162 |
# File 'batch/ecsec2_container_definition_props.rb', line 160 def gpu @gpu end |
#image ⇒ AWSCDK::ECS::ContainerImage (readonly)
The image that this container will run.
71 72 73 |
# File 'batch/ecsec2_container_definition_props.rb', line 71 def image @image end |
#job_role ⇒ AWSCDK::IAM::IRole? (readonly)
Default: - no job role
The role that the container can assume.
116 117 118 |
# File 'batch/ecsec2_container_definition_props.rb', line 116 def job_role @job_role end |
#linux_parameters ⇒ AWSCDK::Batch::LinuxParameters? (readonly)
Default: none
Linux-specific modifications that are applied to the container, such as details for device mappings.
121 122 123 |
# File 'batch/ecsec2_container_definition_props.rb', line 121 def linux_parameters @linux_parameters end |
#logging ⇒ AWSCDK::ECS::LogDriver? (readonly)
Default: - the log configuration of the Docker daemon
The loging configuration for this Job.
126 127 128 |
# File 'batch/ecsec2_container_definition_props.rb', line 126 def logging @logging end |
#memory ⇒ AWSCDK::Size (readonly)
The memory hard limit present to the container.
If your container attempts to exceed the memory specified, the container is terminated. You must specify at least 4 MiB of memory for a job.
78 79 80 |
# File 'batch/ecsec2_container_definition_props.rb', line 78 def memory @memory end |
#privileged ⇒ Boolean? (readonly)
Default: false
When this parameter is true, the container is given elevated permissions on the host container instance (similar to the root user).
165 166 167 |
# File 'batch/ecsec2_container_definition_props.rb', line 165 def privileged @privileged end |
#readonly_root_filesystem ⇒ Boolean? (readonly)
Default: false
Gives the container readonly access to its root filesystem.
131 132 133 |
# File 'batch/ecsec2_container_definition_props.rb', line 131 def readonly_root_filesystem @readonly_root_filesystem end |
#secrets ⇒ Hash{String => AWSCDK::Batch::Secret}? (readonly)
Default: - no secrets
A map from environment variable names to the secrets for the container.
Allows your job definitions to reference the secret by the environment variable name defined in this property.
140 141 142 |
# File 'batch/ecsec2_container_definition_props.rb', line 140 def secrets @secrets end |
#ulimits ⇒ Array<AWSCDK::Batch::Ulimit>? (readonly)
Default: - no ulimits
Limits to set for the user this docker container will run as.
170 171 172 |
# File 'batch/ecsec2_container_definition_props.rb', line 170 def ulimits @ulimits end |
#user ⇒ String? (readonly)
Default: - no user
The user name to use inside the container.
145 146 147 |
# File 'batch/ecsec2_container_definition_props.rb', line 145 def user @user end |
#volumes ⇒ Array<AWSCDK::Batch::ECSVolume>? (readonly)
Default: - no volumes
The volumes to mount to this container.
Automatically added to the job definition.
152 153 154 |
# File 'batch/ecsec2_container_definition_props.rb', line 152 def volumes @volumes end |
Class Method Details
.jsii_properties ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'batch/ecsec2_container_definition_props.rb', line 172 def self.jsii_properties { :cpu => "cpu", :image => "image", :memory => "memory", :command => "command", :enable_execute_command => "enableExecuteCommand", :environment => "environment", :execution_role => "executionRole", :job_role => "jobRole", :linux_parameters => "linuxParameters", :logging => "logging", :readonly_root_filesystem => "readonlyRootFilesystem", :secrets => "secrets", :user => "user", :volumes => "volumes", :gpu => "gpu", :privileged => "privileged", :ulimits => "ulimits", } end |
Instance Method Details
#to_jsii ⇒ Object
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'batch/ecsec2_container_definition_props.rb', line 194 def to_jsii result = {} result.merge!(super) result.merge!({ "cpu" => @cpu, "image" => @image, "memory" => @memory, "command" => @command, "enableExecuteCommand" => @enable_execute_command, "environment" => @environment, "executionRole" => @execution_role, "jobRole" => @job_role, "linuxParameters" => @linux_parameters, "logging" => @logging, "readonlyRootFilesystem" => @readonly_root_filesystem, "secrets" => @secrets, "user" => @user, "volumes" => @volumes, "gpu" => @gpu, "privileged" => @privileged, "ulimits" => @ulimits, }) result.compact end |