Class FargateTaskDefinition

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IConstruct, IDependable, IResource, IFargateTaskDefinition, ITaskDefinition, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:47.347Z") @Stability(Stable) public class FargateTaskDefinition extends TaskDefinition implements IFargateTaskDefinition
The details of a task definition run on a Fargate cluster.

Example:

 FargateTaskDefinition fargateTaskDefinition = FargateTaskDefinition.Builder.create(this, "TaskDef")
         .memoryLimitMiB(512)
         .cpu(256)
         .build();
 ContainerDefinition container = fargateTaskDefinition.addContainer("WebContainer", ContainerDefinitionOptions.builder()
         // Use an image from DockerHub
         .image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
         .build());
 
  • Constructor Details

    • FargateTaskDefinition

      protected FargateTaskDefinition(software.amazon.jsii.JsiiObjectRef objRef)
    • FargateTaskDefinition

      protected FargateTaskDefinition(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • FargateTaskDefinition

      @Stability(Stable) public FargateTaskDefinition(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable FargateTaskDefinitionProps props)
      Constructs a new instance of the FargateTaskDefinition class.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • FargateTaskDefinition

      @Stability(Stable) public FargateTaskDefinition(@NotNull software.constructs.Construct scope, @NotNull String id)
      Constructs a new instance of the FargateTaskDefinition class.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • fromFargateTaskDefinitionArn

      @Stability(Stable) @NotNull public static IFargateTaskDefinition fromFargateTaskDefinitionArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String fargateTaskDefinitionArn)
      Imports a task definition from the specified task definition ARN.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      fargateTaskDefinitionArn - This parameter is required.
    • fromFargateTaskDefinitionAttributes

      @Stability(Stable) @NotNull public static IFargateTaskDefinition fromFargateTaskDefinitionAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull FargateTaskDefinitionAttributes attrs)
      Import an existing Fargate task definition from its attributes.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      attrs - This parameter is required.
    • getNetworkMode

      @Stability(Stable) @NotNull public NetworkMode getNetworkMode()
      The Docker networking mode to use for the containers in the task.

      Fargate tasks require the awsvpc network mode.

      Specified by:
      getNetworkMode in interface ITaskDefinition
      Overrides:
      getNetworkMode in class TaskDefinition
    • getEphemeralStorageGiB

      @Stability(Stable) @Nullable public Number getEphemeralStorageGiB()
      The amount (in GiB) of ephemeral storage to be allocated to the task.
      Overrides:
      getEphemeralStorageGiB in class TaskDefinition