Class: AWSCDK::Batch::CfnJobDefinition::TaskContainerPropertiesProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
batch/cfn_job_definition.rb

Overview

Container properties are used for Amazon ECS-based job definitions.

These properties to describe the container that's launched as part of a job.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image:, command: nil, depends_on: nil, environment: nil, essential: nil, firelens_configuration: nil, linux_parameters: nil, log_configuration: nil, mount_points: nil, name: nil, privileged: nil, readonly_root_filesystem: nil, repository_credentials: nil, resource_requirements: nil, secrets: nil, start_timeout: nil, stop_timeout: nil, ulimits: nil, user: nil) ⇒ TaskContainerPropertiesProperty

Returns a new instance of TaskContainerPropertiesProperty.

Parameters:



3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
# File 'batch/cfn_job_definition.rb', line 3589

def initialize(image:, command: nil, depends_on: nil, environment: nil, essential: nil, firelens_configuration: nil, linux_parameters: nil, log_configuration: nil, mount_points: nil, name: nil, privileged: nil, readonly_root_filesystem: nil, repository_credentials: nil, resource_requirements: nil, secrets: nil, start_timeout: nil, stop_timeout: nil, ulimits: nil, user: nil)
  @image = image
  Jsii::Type.check_type(@image, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "image")
  @command = command
  Jsii::Type.check_type(@command, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "command") unless @command.nil?
  @depends_on = depends_on
  Jsii::Type.check_type(@depends_on, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guQ2ZuSm9iRGVmaW5pdGlvbi5UYXNrQ29udGFpbmVyRGVwZW5kZW5jeVByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "dependsOn") unless @depends_on.nil?
  @environment = environment
  Jsii::Type.check_type(@environment, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guQ2ZuSm9iRGVmaW5pdGlvbi5FbnZpcm9ubWVudFByb3BlcnR5In1dfX0sImtpbmQiOiJhcnJheSJ9fV19fQ==")), "environment") unless @environment.nil?
  @essential = essential
  Jsii::Type.check_type(@essential, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "essential") unless @essential.nil?
  @firelens_configuration = firelens_configuration.is_a?(Hash) ? ::AWSCDK::Batch::CfnJobDefinition::FirelensConfigurationProperty.new(**firelens_configuration.transform_keys(&:to_sym)) : firelens_configuration
  Jsii::Type.check_type(@firelens_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5DZm5Kb2JEZWZpbml0aW9uLkZpcmVsZW5zQ29uZmlndXJhdGlvblByb3BlcnR5In1dfX0=")), "firelensConfiguration") unless @firelens_configuration.nil?
  @linux_parameters = linux_parameters.is_a?(Hash) ? ::AWSCDK::Batch::CfnJobDefinition::LinuxParametersProperty.new(**linux_parameters.transform_keys(&:to_sym)) : linux_parameters
  Jsii::Type.check_type(@linux_parameters, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5DZm5Kb2JEZWZpbml0aW9uLkxpbnV4UGFyYW1ldGVyc1Byb3BlcnR5In1dfX0=")), "linuxParameters") unless @linux_parameters.nil?
  @log_configuration = log_configuration.is_a?(Hash) ? ::AWSCDK::Batch::CfnJobDefinition::LogConfigurationProperty.new(**log_configuration.transform_keys(&:to_sym)) : log_configuration
  Jsii::Type.check_type(@log_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5DZm5Kb2JEZWZpbml0aW9uLkxvZ0NvbmZpZ3VyYXRpb25Qcm9wZXJ0eSJ9XX19")), "logConfiguration") unless @log_configuration.nil?
  @mount_points = mount_points
  Jsii::Type.check_type(@mount_points, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guQ2ZuSm9iRGVmaW5pdGlvbi5Nb3VudFBvaW50UHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "mountPoints") unless @mount_points.nil?
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name") unless @name.nil?
  @privileged = privileged
  Jsii::Type.check_type(@privileged, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "privileged") unless @privileged.nil?
  @readonly_root_filesystem = readonly_root_filesystem
  Jsii::Type.check_type(@readonly_root_filesystem, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "readonlyRootFilesystem") unless @readonly_root_filesystem.nil?
  @repository_credentials = repository_credentials.is_a?(Hash) ? ::AWSCDK::Batch::CfnJobDefinition::RepositoryCredentialsProperty.new(**repository_credentials.transform_keys(&:to_sym)) : repository_credentials
  Jsii::Type.check_type(@repository_credentials, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19iYXRjaC5DZm5Kb2JEZWZpbml0aW9uLlJlcG9zaXRvcnlDcmVkZW50aWFsc1Byb3BlcnR5In1dfX0=")), "repositoryCredentials") unless @repository_credentials.nil?
  @resource_requirements = resource_requirements
  Jsii::Type.check_type(@resource_requirements, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guQ2ZuSm9iRGVmaW5pdGlvbi5SZXNvdXJjZVJlcXVpcmVtZW50UHJvcGVydHkifV19fSwia2luZCI6ImFycmF5In19XX19")), "resourceRequirements") unless @resource_requirements.nil?
  @secrets = secrets
  Jsii::Type.check_type(@secrets, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guQ2ZuSm9iRGVmaW5pdGlvbi5TZWNyZXRQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "secrets") unless @secrets.nil?
  @start_timeout = start_timeout
  Jsii::Type.check_type(@start_timeout, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "startTimeout") unless @start_timeout.nil?
  @stop_timeout = stop_timeout
  Jsii::Type.check_type(@stop_timeout, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "stopTimeout") unless @stop_timeout.nil?
  @ulimits = ulimits
  Jsii::Type.check_type(@ulimits, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsidW5pb24iOnsidHlwZXMiOlt7ImZxbiI6ImF3cy1jZGstbGliLklSZXNvbHZhYmxlIn0seyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmF0Y2guQ2ZuSm9iRGVmaW5pdGlvbi5VbGltaXRQcm9wZXJ0eSJ9XX19LCJraW5kIjoiYXJyYXkifX1dfX0=")), "ulimits") unless @ulimits.nil?
  @user = user
  Jsii::Type.check_type(@user, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "user") unless @user.nil?
end

Instance Attribute Details

#commandArray<String>? (readonly)

The command that's passed to the container.

This parameter maps to Cmd in the Create a container section of the Docker Remote API and the COMMAND parameter to docker run . For more information, see Dockerfile reference: CMD .



3643
3644
3645
# File 'batch/cfn_job_definition.rb', line 3643

def command
  @command
end

#depends_onAWSCDK::IResolvable, ... (readonly)

A list of containers that this container depends on.



3648
3649
3650
# File 'batch/cfn_job_definition.rb', line 3648

def depends_on
  @depends_on
end

#environmentAWSCDK::IResolvable, ... (readonly)

The environment variables to pass to a container.

This parameter maps to Env in the Create a container section of the Docker Remote API and the --env parameter to docker run .

We don't recommend using plaintext environment variables for sensitive information, such as credential data. > Environment variables cannot start with AWS_BATCH . This naming convention is reserved for variables that AWS Batch sets.



3657
3658
3659
# File 'batch/cfn_job_definition.rb', line 3657

def environment
  @environment
end

#essentialBoolean, ... (readonly)

If the essential parameter of a container is marked as true , and that container fails or stops for any reason, all other containers that are part of the task are stopped.

If the essential parameter of a container is marked as false, its failure doesn't affect the rest of the containers in a task. If this parameter is omitted, a container is assumed to be essential.

All jobs must have at least one essential container. If you have an application that's composed of multiple containers, group containers that are used for a common purpose into components, and separate the different components into multiple task definitions. For more information, see Application Architecture in the Amazon Elastic Container Service Developer Guide .



3666
3667
3668
# File 'batch/cfn_job_definition.rb', line 3666

def essential
  @essential
end

#firelens_configurationAWSCDK::IResolvable, ... (readonly)

The FireLens configuration for the container.

This is used to specify and configure a log router for container logs. For more information, see Custom log routing in the Amazon Elastic Container Service Developer Guide .



3673
3674
3675
# File 'batch/cfn_job_definition.rb', line 3673

def firelens_configuration
  @firelens_configuration
end

#imageString (readonly)

The image used to start a container.

This string is passed directly to the Docker daemon. By default, images in the Docker Hub registry are available. Other repositories are specified with either repository-url/image:tag or repository-url/image@digest . Up to 255 letters (uppercase and lowercase), numbers, hyphens, underscores, colons, periods, forward slashes, and number signs are allowed. This parameter maps to Image in the Create a container section of the Docker Remote API and the IMAGE parameter of the docker run .



3636
3637
3638
# File 'batch/cfn_job_definition.rb', line 3636

def image
  @image
end

#linux_parametersAWSCDK::IResolvable, ... (readonly)

Linux-specific modifications that are applied to the container, such as Linux kernel capabilities.

For more information, see KernelCapabilities .



3680
3681
3682
# File 'batch/cfn_job_definition.rb', line 3680

def linux_parameters
  @linux_parameters
end

#log_configurationAWSCDK::IResolvable, ... (readonly)

The log configuration specification for the container.

This parameter maps to LogConfig in the Create a container section of the Docker Remote API and the --log-driver option to docker run .

By default, containers use the same logging driver that the Docker daemon uses. However the container can use a different logging driver than the Docker daemon by specifying a log driver with this parameter in the container definition. To use a different logging driver for a container, the log system must be configured properly on the container instance (or on a different log server for remote logging options). For more information about the options for different supported log drivers, see Configure logging drivers in the Docker documentation .

Amazon ECS currently supports a subset of the logging drivers available to the Docker daemon (shown in the LogConfiguration data type). Additional log drivers may be available in future releases of the Amazon ECS container agent.

This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version --format '{{.Server.APIVersion}}'

The Amazon ECS container agent running on a container instance must register the logging drivers available on that instance with the ECS_AVAILABLE_LOGGING_DRIVERS environment variable before containers placed on that instance can use these log configuration options. For more information, see Amazon ECS container agent configuration in the Amazon Elastic Container Service Developer Guide .



3695
3696
3697
# File 'batch/cfn_job_definition.rb', line 3695

def log_configuration
  @log_configuration
end

#mount_pointsAWSCDK::IResolvable, ... (readonly)

The mount points for data volumes in your container.

This parameter maps to Volumes in the Create a container section of the Docker Remote API and the --volume option to docker run .

Windows containers can mount whole directories on the same drive as $env:ProgramData . Windows containers can't mount directories on a different drive, and mount point can't be across drives.



3704
3705
3706
# File 'batch/cfn_job_definition.rb', line 3704

def mount_points
  @mount_points
end

#nameString? (readonly)

The name of a container.

The name can be used as a unique identifier to target your depends_on and Overrides objects.



3711
3712
3713
# File 'batch/cfn_job_definition.rb', line 3711

def name
  @name
end

#privilegedBoolean, ... (readonly)

When this parameter is true , the container is given elevated privileges on the host container instance (similar to the root user).

This parameter maps to Privileged in the Create a container section of the Docker Remote API and the --privileged option to docker run .

This parameter is not supported for Windows containers or tasks run on Fargate.



3720
3721
3722
# File 'batch/cfn_job_definition.rb', line 3720

def privileged
  @privileged
end

#readonly_root_filesystemBoolean, ... (readonly)

When this parameter is true, the container is given read-only access to its root file system.

This parameter maps to ReadonlyRootfs in the Create a container section of the Docker Remote API and the --read-only option to docker run .

This parameter is not supported for Windows containers.



3729
3730
3731
# File 'batch/cfn_job_definition.rb', line 3729

def readonly_root_filesystem
  @readonly_root_filesystem
end

#repository_credentialsAWSCDK::IResolvable, ... (readonly)

The private repository authentication credentials to use.



3734
3735
3736
# File 'batch/cfn_job_definition.rb', line 3734

def repository_credentials
  @repository_credentials
end

#resource_requirementsAWSCDK::IResolvable, ... (readonly)

The type and amount of a resource to assign to a container.

The only supported resource is a GPU.



3741
3742
3743
# File 'batch/cfn_job_definition.rb', line 3741

def resource_requirements
  @resource_requirements
end

#secretsAWSCDK::IResolvable, ... (readonly)

The secrets to pass to the container.

For more information, see Specifying Sensitive Data in the Amazon Elastic Container Service Developer Guide.



3748
3749
3750
# File 'batch/cfn_job_definition.rb', line 3748

def secrets
  @secrets
end

#start_timeoutNumeric? (readonly)



3751
3752
3753
# File 'batch/cfn_job_definition.rb', line 3751

def start_timeout
  @start_timeout
end

#stop_timeoutNumeric? (readonly)



3754
3755
3756
# File 'batch/cfn_job_definition.rb', line 3754

def stop_timeout
  @stop_timeout
end

#ulimitsAWSCDK::IResolvable, ... (readonly)

A list of ulimits to set in the container.

If a ulimit value is specified in a task definition, it overrides the default values set by Docker. This parameter maps to Ulimits in the Create a container section of the Docker Remote API and the --ulimit option to docker run .

Amazon ECS tasks hosted on Fargate use the default resource limit values set by the operating system with the exception of the nofile resource limit parameter which Fargate overrides. The nofile resource limit sets a restriction on the number of open files that a container can use. The default nofile soft limit is 1024 and the default hard limit is 65535 .

This parameter requires version 1.18 of the Docker Remote API or greater on your container instance. To check the Docker Remote API version on your container instance, log in to your container instance and run the following command: sudo docker version --format '{{.Server.APIVersion}}'

This parameter is not supported for Windows containers.



3767
3768
3769
# File 'batch/cfn_job_definition.rb', line 3767

def ulimits
  @ulimits
end

#userString? (readonly)

The user to use inside the container.

This parameter maps to User in the Create a container section of the Docker Remote API and the --user option to docker run.

When running tasks using the host network mode, don't run containers using the root user (UID 0) . We recommend using a non-root user for better security.

You can specify the user using the following formats. If specifying a UID or GID, you must specify it as a positive integer.

  • user
  • user:group
  • uid
  • uid:gid
  • user:gi
  • uid:group

This parameter is not supported for Windows containers.



3787
3788
3789
# File 'batch/cfn_job_definition.rb', line 3787

def user
  @user
end

Class Method Details

.jsii_propertiesObject



3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
# File 'batch/cfn_job_definition.rb', line 3789

def self.jsii_properties
  {
    :image => "image",
    :command => "command",
    :depends_on => "dependsOn",
    :environment => "environment",
    :essential => "essential",
    :firelens_configuration => "firelensConfiguration",
    :linux_parameters => "linuxParameters",
    :log_configuration => "logConfiguration",
    :mount_points => "mountPoints",
    :name => "name",
    :privileged => "privileged",
    :readonly_root_filesystem => "readonlyRootFilesystem",
    :repository_credentials => "repositoryCredentials",
    :resource_requirements => "resourceRequirements",
    :secrets => "secrets",
    :start_timeout => "startTimeout",
    :stop_timeout => "stopTimeout",
    :ulimits => "ulimits",
    :user => "user",
  }
end

Instance Method Details

#to_jsiiObject



3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
# File 'batch/cfn_job_definition.rb', line 3813

def to_jsii
  result = {}
  result.merge!({
    "image" => @image,
    "command" => @command,
    "dependsOn" => @depends_on,
    "environment" => @environment,
    "essential" => @essential,
    "firelensConfiguration" => @firelens_configuration,
    "linuxParameters" => @linux_parameters,
    "logConfiguration" => @log_configuration,
    "mountPoints" => @mount_points,
    "name" => @name,
    "privileged" => @privileged,
    "readonlyRootFilesystem" => @readonly_root_filesystem,
    "repositoryCredentials" => @repository_credentials,
    "resourceRequirements" => @resource_requirements,
    "secrets" => @secrets,
    "startTimeout" => @start_timeout,
    "stopTimeout" => @stop_timeout,
    "ulimits" => @ulimits,
    "user" => @user,
  })
  result.compact
end