Skip to content
v2.274.0

CommonTaskDefinitionProps Struct ​

The common properties for all task definitions.

For more information, see Task Definition Parameters.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';

declare const proxyConfiguration: ecs.ProxyConfiguration;
declare const role: iam.Role;
const commonTaskDefinitionProps: ecs.CommonTaskDefinitionProps = {
  enableFaultInjection: false,
  executionRole: role,
  family: 'family',
  proxyConfiguration: proxyConfiguration,
  taskRole: role,
  volumes: [{
    name: 'name',

    // the properties below are optional
    configuredAtLaunch: false,
    dockerVolumeConfiguration: {
      driver: 'driver',
      scope: ecs.Scope.TASK,

      // the properties below are optional
      autoprovision: false,
      driverOpts: {
        driverOptsKey: 'driverOpts',
      },
      labels: {
        labelsKey: 'labels',
      },
    },
    efsVolumeConfiguration: {
      fileSystemId: 'fileSystemId',

      // the properties below are optional
      authorizationConfig: {
        accessPointId: 'accessPointId',
        iam: 'iam',
      },
      rootDirectory: 'rootDirectory',
      transitEncryption: 'transitEncryption',
      transitEncryptionPort: 123,
    },
    host: {
      sourcePath: 'sourcePath',
    },
  }],
};

Properties ​

enableFaultInjectionbooleanenable_fault_injectionboolenableFaultInjectionBooleanEnableFaultInjectionboolEnableFaultInjection*bool= undefined - ECS default setting …#
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 {@link NetworkMode.AWS_VPC} or {@link NetworkMode.HOST} network modes.

default

Default: undefined - ECS default setting is false

executionRoleIRoleexecution_roleIRoleexecutionRoleIRoleExecutionRoleIRoleExecutionRoleIRole= An execution role will be automa…#
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

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

familystringfamilystrfamilyStringFamilystringFamily*string= Automatically generated name.#
The name of a family that this task definition is registered to.

A family groups multiple versions of a task definition.

proxyConfigurationProxyConfigurationproxy_configurationProxyConfigurationproxyConfigurationProxyConfigurationProxyConfigurationProxyConfigurationProxyConfigurationProxyConfiguration= No proxy configuration.#
The configuration details for the App Mesh proxy.
taskRoleIRoletask_roleIRoletaskRoleIRoleTaskRoleIRoleTaskRoleIRole= A task role is automatically cre…#
The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.
default

Default: A task role is automatically created for you.

volumesVolume[]volumestyping.List[Volume]volumesList<Volume>VolumesVolume[]Volumes*[]Volume= No volumes are passed to the Doc…#
The list of volume definitions for the task.

For more information, see Task Definition Parameter Volumes.

default

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