Class CfnTaskDefinitionPropsMixin

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.Mixin
software.amazon.awscdk.cfnpropertymixins.services.ecs.CfnTaskDefinitionPropsMixin
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable, software.constructs.IMixin

@Generated(value="jsii-pacmak/1.127.0 (build 2117ad5)", date="2026-03-11T13:19:58.943Z") @Stability(Stable) public class CfnTaskDefinitionPropsMixin extends Mixin implements software.constructs.IMixin
Registers a new task definition from the supplied family and containerDefinitions .

Optionally, you can add data volumes to your containers with the volumes parameter. For more information about task definition parameters and defaults, see Amazon ECS Task Definitions in the Amazon Elastic Container Service Developer Guide .

You can specify a role for your task with the taskRoleArn parameter. When you specify a role for a task, its containers can then use the latest versions of the AWS CLI or SDKs to make API requests to the AWS services that are specified in the policy that's associated with the role. For more information, see IAM Roles for Tasks in the Amazon Elastic Container Service Developer Guide .

You can specify a Docker networking mode for the containers in your task definition with the networkMode parameter. If you specify the awsvpc network mode, the task is allocated an elastic network interface, and you must specify a NetworkConfiguration when you create a service or run a task with the task definition. For more information, see Task Networking in the Amazon Elastic Container Service Developer Guide .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.cfnpropertymixins.services.ecs.*;
 import software.amazon.awscdk.*;
 IMergeStrategy mergeStrategy;
 CfnTaskDefinitionPropsMixin cfnTaskDefinitionPropsMixin = CfnTaskDefinitionPropsMixin.Builder.create(CfnTaskDefinitionMixinProps.builder()
         .containerDefinitions(List.of(ContainerDefinitionProperty.builder()
                 .command(List.of("command"))
                 .cpu(123)
                 .credentialSpecs(List.of("credentialSpecs"))
                 .dependsOn(List.of(ContainerDependencyProperty.builder()
                         .condition("condition")
                         .containerName("containerName")
                         .build()))
                 .disableNetworking(false)
                 .dnsSearchDomains(List.of("dnsSearchDomains"))
                 .dnsServers(List.of("dnsServers"))
                 .dockerLabels(Map.of(
                         "dockerLabelsKey", "dockerLabels"))
                 .dockerSecurityOptions(List.of("dockerSecurityOptions"))
                 .entryPoint(List.of("entryPoint"))
                 .environment(List.of(KeyValuePairProperty.builder()
                         .name("name")
                         .value("value")
                         .build()))
                 .environmentFiles(List.of(EnvironmentFileProperty.builder()
                         .type("type")
                         .value("value")
                         .build()))
                 .essential(false)
                 .extraHosts(List.of(HostEntryProperty.builder()
                         .hostname("hostname")
                         .ipAddress("ipAddress")
                         .build()))
                 .firelensConfiguration(FirelensConfigurationProperty.builder()
                         .options(Map.of(
                                 "optionsKey", "options"))
                         .type("type")
                         .build())
                 .healthCheck(HealthCheckProperty.builder()
                         .command(List.of("command"))
                         .interval(123)
                         .retries(123)
                         .startPeriod(123)
                         .timeout(123)
                         .build())
                 .hostname("hostname")
                 .image("image")
                 .interactive(false)
                 .links(List.of("links"))
                 .linuxParameters(LinuxParametersProperty.builder()
                         .capabilities(KernelCapabilitiesProperty.builder()
                                 .add(List.of("add"))
                                 .drop(List.of("drop"))
                                 .build())
                         .devices(List.of(DeviceProperty.builder()
                                 .containerPath("containerPath")
                                 .hostPath("hostPath")
                                 .permissions(List.of("permissions"))
                                 .build()))
                         .initProcessEnabled(false)
                         .maxSwap(123)
                         .sharedMemorySize(123)
                         .swappiness(123)
                         .tmpfs(List.of(TmpfsProperty.builder()
                                 .containerPath("containerPath")
                                 .mountOptions(List.of("mountOptions"))
                                 .size(123)
                                 .build()))
                         .build())
                 .logConfiguration(LogConfigurationProperty.builder()
                         .logDriver("logDriver")
                         .options(Map.of(
                                 "optionsKey", "options"))
                         .secretOptions(List.of(SecretProperty.builder()
                                 .name("name")
                                 .valueFrom("valueFrom")
                                 .build()))
                         .build())
                 .memory(123)
                 .memoryReservation(123)
                 .mountPoints(List.of(MountPointProperty.builder()
                         .containerPath("containerPath")
                         .readOnly(false)
                         .sourceVolume("sourceVolume")
                         .build()))
                 .name("name")
                 .portMappings(List.of(PortMappingProperty.builder()
                         .appProtocol("appProtocol")
                         .containerPort(123)
                         .containerPortRange("containerPortRange")
                         .hostPort(123)
                         .name("name")
                         .protocol("protocol")
                         .build()))
                 .privileged(false)
                 .pseudoTerminal(false)
                 .readonlyRootFilesystem(false)
                 .repositoryCredentials(RepositoryCredentialsProperty.builder()
                         .credentialsParameter("credentialsParameter")
                         .build())
                 .resourceRequirements(List.of(ResourceRequirementProperty.builder()
                         .type("type")
                         .value("value")
                         .build()))
                 .restartPolicy(RestartPolicyProperty.builder()
                         .enabled(false)
                         .ignoredExitCodes(List.of(123))
                         .restartAttemptPeriod(123)
                         .build())
                 .secrets(List.of(SecretProperty.builder()
                         .name("name")
                         .valueFrom("valueFrom")
                         .build()))
                 .startTimeout(123)
                 .stopTimeout(123)
                 .systemControls(List.of(SystemControlProperty.builder()
                         .namespace("namespace")
                         .value("value")
                         .build()))
                 .ulimits(List.of(UlimitProperty.builder()
                         .hardLimit(123)
                         .name("name")
                         .softLimit(123)
                         .build()))
                 .user("user")
                 .versionConsistency("versionConsistency")
                 .volumesFrom(List.of(VolumeFromProperty.builder()
                         .readOnly(false)
                         .sourceContainer("sourceContainer")
                         .build()))
                 .workingDirectory("workingDirectory")
                 .build()))
         .cpu("cpu")
         .enableFaultInjection(false)
         .ephemeralStorage(EphemeralStorageProperty.builder()
                 .sizeInGiB(123)
                 .build())
         .executionRoleArn("executionRoleArn")
         .family("family")
         .inferenceAccelerators(List.of(InferenceAcceleratorProperty.builder()
                 .deviceName("deviceName")
                 .deviceType("deviceType")
                 .build()))
         .ipcMode("ipcMode")
         .memory("memory")
         .networkMode("networkMode")
         .pidMode("pidMode")
         .placementConstraints(List.of(TaskDefinitionPlacementConstraintProperty.builder()
                 .expression("expression")
                 .type("type")
                 .build()))
         .proxyConfiguration(ProxyConfigurationProperty.builder()
                 .containerName("containerName")
                 .proxyConfigurationProperties(List.of(KeyValuePairProperty.builder()
                         .name("name")
                         .value("value")
                         .build()))
                 .type("type")
                 .build())
         .requiresCompatibilities(List.of("requiresCompatibilities"))
         .runtimePlatform(RuntimePlatformProperty.builder()
                 .cpuArchitecture("cpuArchitecture")
                 .operatingSystemFamily("operatingSystemFamily")
                 .build())
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .taskRoleArn("taskRoleArn")
         .volumes(List.of(VolumeProperty.builder()
                 .configuredAtLaunch(false)
                 .dockerVolumeConfiguration(DockerVolumeConfigurationProperty.builder()
                         .autoprovision(false)
                         .driver("driver")
                         .driverOpts(Map.of(
                                 "driverOptsKey", "driverOpts"))
                         .labels(Map.of(
                                 "labelsKey", "labels"))
                         .scope("scope")
                         .build())
                 .efsVolumeConfiguration(EFSVolumeConfigurationProperty.builder()
                         .authorizationConfig(AuthorizationConfigProperty.builder()
                                 .accessPointId("accessPointId")
                                 .iam("iam")
                                 .build())
                         .filesystemId("filesystemId")
                         .rootDirectory("rootDirectory")
                         .transitEncryption("transitEncryption")
                         .transitEncryptionPort(123)
                         .build())
                 .fSxWindowsFileServerVolumeConfiguration(FSxWindowsFileServerVolumeConfigurationProperty.builder()
                         .authorizationConfig(FSxAuthorizationConfigProperty.builder()
                                 .credentialsParameter("credentialsParameter")
                                 .domain("domain")
                                 .build())
                         .fileSystemId("fileSystemId")
                         .rootDirectory("rootDirectory")
                         .build())
                 .host(HostVolumePropertiesProperty.builder()
                         .sourcePath("sourcePath")
                         .build())
                 .name("name")
                 .build()))
         .build())
 .strategy(mergeStrategy)
 .build();
 

See Also:
  • Field Details

    • CFN_PROPERTY_KEYS

      @Stability(Stable) protected static final List<String> CFN_PROPERTY_KEYS
  • Constructor Details

    • CfnTaskDefinitionPropsMixin

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

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

      @Stability(Stable) public CfnTaskDefinitionPropsMixin(@NotNull CfnTaskDefinitionMixinProps props, @Nullable CfnPropertyMixinOptions options)
      Create a mixin to apply properties to AWS::ECS::TaskDefinition.

      Parameters:
      props - L1 properties to apply. This parameter is required.
      options - Mixin options.
    • CfnTaskDefinitionPropsMixin

      @Stability(Stable) public CfnTaskDefinitionPropsMixin(@NotNull CfnTaskDefinitionMixinProps props)
      Create a mixin to apply properties to AWS::ECS::TaskDefinition.

      Parameters:
      props - L1 properties to apply. This parameter is required.
  • Method Details

    • applyTo

      @Stability(Stable) public void applyTo(@NotNull software.constructs.IConstruct construct)
      Apply the mixin properties to the construct.

      Specified by:
      applyTo in interface software.constructs.IMixin
      Specified by:
      applyTo in class Mixin
      Parameters:
      construct - This parameter is required.
    • supports

      @Stability(Stable) @NotNull public Boolean supports(@NotNull software.constructs.IConstruct construct)
      Check if this mixin supports the given construct.

      Specified by:
      supports in interface software.constructs.IMixin
      Overrides:
      supports in class Mixin
      Parameters:
      construct - This parameter is required.
    • getProps

      @Stability(Stable) @NotNull protected CfnTaskDefinitionMixinProps getProps()
    • getStrategy

      @Stability(Stable) @NotNull protected IMergeStrategy getStrategy()