Class Ec2TaskDefinition.Builder

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

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

    • create

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

      @Stability(Stable) public Ec2TaskDefinition.Builder enableFaultInjection(Boolean enableFaultInjection)
      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

      invalid @link
      NetworkMode.AWS_VPC
      or
      invalid @link
      NetworkMode.HOST
      network modes.

      Default: undefined - ECS default setting is false

      Parameters:
      enableFaultInjection - Enables fault injection and allows for fault injection requests to be accepted from the task's containers. This parameter is required.
      Returns:
      this
    • executionRole

      @Stability(Stable) public Ec2TaskDefinition.Builder executionRole(IRole executionRole)
      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.

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

      Parameters:
      executionRole - The name of the IAM task execution role that grants the ECS agent permission to call AWS APIs on your behalf. This parameter is required.
      Returns:
      this
    • family

      @Stability(Stable) public Ec2TaskDefinition.Builder family(String family)
      The name of a family that this task definition is registered to.

      A family groups multiple versions of a task definition.

      Default: - Automatically generated name.

      Parameters:
      family - The name of a family that this task definition is registered to. This parameter is required.
      Returns:
      this
    • proxyConfiguration

      @Stability(Stable) public Ec2TaskDefinition.Builder proxyConfiguration(ProxyConfiguration proxyConfiguration)
      The configuration details for the App Mesh proxy.

      Default: - No proxy configuration.

      Parameters:
      proxyConfiguration - The configuration details for the App Mesh proxy. This parameter is required.
      Returns:
      this
    • taskRole

      @Stability(Stable) public Ec2TaskDefinition.Builder taskRole(IRole taskRole)
      The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.

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

      Parameters:
      taskRole - The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf. This parameter is required.
      Returns:
      this
    • volumes

      @Stability(Stable) public Ec2TaskDefinition.Builder volumes(List<? extends Volume> volumes)
      The list of volume definitions for the task.

      For more information, see Task Definition Parameter Volumes.

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

      Parameters:
      volumes - The list of volume definitions for the task. This parameter is required.
      Returns:
      this
    • inferenceAccelerators

      @Stability(Stable) public Ec2TaskDefinition.Builder inferenceAccelerators(List<? extends InferenceAccelerator> inferenceAccelerators)
      The inference accelerators to use for the containers in the task.

      Not supported in Fargate.

      Default: - No inference accelerators.

      Parameters:
      inferenceAccelerators - The inference accelerators to use for the containers in the task. This parameter is required.
      Returns:
      this
    • ipcMode

      @Stability(Stable) public Ec2TaskDefinition.Builder ipcMode(IpcMode ipcMode)
      The IPC resource namespace to use for the containers in the task.

      Not supported in Fargate and Windows containers.

      Default: - IpcMode used by the task is not specified

      Parameters:
      ipcMode - The IPC resource namespace to use for the containers in the task. This parameter is required.
      Returns:
      this
    • networkMode

      @Stability(Stable) public Ec2TaskDefinition.Builder networkMode(NetworkMode networkMode)
      The Docker networking mode to use for the containers in the task.

      The valid values are NONE, BRIDGE, AWS_VPC, and HOST.

      Default: - NetworkMode.BRIDGE for EC2 tasks, AWS_VPC for Fargate tasks.

      Parameters:
      networkMode - The Docker networking mode to use for the containers in the task. This parameter is required.
      Returns:
      this
    • pidMode

      @Stability(Stable) public Ec2TaskDefinition.Builder pidMode(PidMode pidMode)
      The process namespace to use for the containers in the task.

      Not supported in Windows containers.

      Default: - PidMode used by the task is not specified

      Parameters:
      pidMode - The process namespace to use for the containers in the task. This parameter is required.
      Returns:
      this
    • placementConstraints

      @Stability(Stable) public Ec2TaskDefinition.Builder placementConstraints(List<? extends PlacementConstraint> placementConstraints)
      An array of placement constraint objects to use for the task.

      You can specify a maximum of 10 constraints per task (this limit includes constraints in the task definition and those specified at run time).

      Default: - No placement constraints.

      Parameters:
      placementConstraints - An array of placement constraint objects to use for the task. This parameter is required.
      Returns:
      this
    • build

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