Class EcsEc2ContainerDefinition.Builder

java.lang.Object
software.amazon.awscdk.services.batch.EcsEc2ContainerDefinition.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<EcsEc2ContainerDefinition>
Enclosing class:
EcsEc2ContainerDefinition

@Stability(Stable) public static final class EcsEc2ContainerDefinition.Builder extends Object implements software.amazon.jsii.Builder<EcsEc2ContainerDefinition>
A fluent builder for EcsEc2ContainerDefinition.
  • Method Details

    • create

      @Stability(Stable) public static EcsEc2ContainerDefinition.Builder create(software.constructs.Construct scope, String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      Returns:
      a new instance of EcsEc2ContainerDefinition.Builder.
    • cpu

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder cpu(Number cpu)
      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.

      Parameters:
      cpu - The number of vCPUs reserved for the container. This parameter is required.
      Returns:
      this
    • image

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder image(ContainerImage image)
      The image that this container will run.

      Parameters:
      image - The image that this container will run. This parameter is required.
      Returns:
      this
    • memory

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder memory(Size memory)
      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.

      Parameters:
      memory - The memory hard limit present to the container. This parameter is required.
      Returns:
      this
    • command

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder command(List<String> command)
      The command that's passed to the container.

      Default: - no command

      Parameters:
      command - The command that's passed to the container. This parameter is required.
      Returns:
      this
      See Also:
    • environment

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder environment(Map<String,String> environment)
      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.

      Default: - no environment variables

      Parameters:
      environment - The environment variables to pass to a container. This parameter is required.
      Returns:
      this
    • executionRole

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder executionRole(IRole executionRole)
      The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf.

      Default: - a Role will be created

      Parameters:
      executionRole - The role used by Amazon ECS container and AWS Fargate agents to make AWS API calls on your behalf. This parameter is required.
      Returns:
      this
      See Also:
    • jobRole

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder jobRole(IRole jobRole)
      The role that the container can assume.

      Default: - no job role

      Parameters:
      jobRole - The role that the container can assume. This parameter is required.
      Returns:
      this
      See Also:
    • linuxParameters

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder linuxParameters(LinuxParameters linuxParameters)
      Linux-specific modifications that are applied to the container, such as details for device mappings.

      Default: none

      Parameters:
      linuxParameters - Linux-specific modifications that are applied to the container, such as details for device mappings. This parameter is required.
      Returns:
      this
    • logging

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder logging(LogDriver logging)
      The loging configuration for this Job.

      Default: - the log configuration of the Docker daemon

      Parameters:
      logging - The loging configuration for this Job. This parameter is required.
      Returns:
      this
    • readonlyRootFilesystem

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder readonlyRootFilesystem(Boolean readonlyRootFilesystem)
      Gives the container readonly access to its root filesystem.

      Default: false

      Parameters:
      readonlyRootFilesystem - Gives the container readonly access to its root filesystem. This parameter is required.
      Returns:
      this
    • secrets

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder secrets(Map<String,? extends Secret> 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.

      Default: - no secrets

      Parameters:
      secrets - A map from environment variable names to the secrets for the container. This parameter is required.
      Returns:
      this
      See Also:
    • user

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder user(String user)
      The user name to use inside the container.

      Default: - no user

      Parameters:
      user - The user name to use inside the container. This parameter is required.
      Returns:
      this
    • volumes

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder volumes(List<? extends EcsVolume> volumes)
      The volumes to mount to this container.

      Automatically added to the job definition.

      Default: - no volumes

      Parameters:
      volumes - The volumes to mount to this container. This parameter is required.
      Returns:
      this
    • gpu

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder gpu(Number gpu)
      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.

      Default: - no gpus

      Parameters:
      gpu - The number of physical GPUs to reserve for the container. This parameter is required.
      Returns:
      this
    • privileged

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder privileged(Boolean privileged)
      When this parameter is true, the container is given elevated permissions on the host container instance (similar to the root user).

      Default: false

      Parameters:
      privileged - When this parameter is true, the container is given elevated permissions on the host container instance (similar to the root user). This parameter is required.
      Returns:
      this
    • ulimits

      @Stability(Stable) public EcsEc2ContainerDefinition.Builder ulimits(List<? extends Ulimit> ulimits)
      Limits to set for the user this docker container will run as.

      Default: - no ulimits

      Parameters:
      ulimits - Limits to set for the user this docker container will run as. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public EcsEc2ContainerDefinition build()
      Specified by:
      build in interface software.amazon.jsii.Builder<EcsEc2ContainerDefinition>
      Returns:
      a newly built instance of EcsEc2ContainerDefinition.