# CommonTaskDefinitionProps

The common properties for all task definitions.

For more information, see
[Task Definition Parameters](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html).

- Source: [`aws-ecs/lib/base/task-definition.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-ecs/lib/base/task-definition.ts#L80)
- Type last changed: v2.175.0 · 10 Jan 2025

## 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

- `enableFaultInjection`: boolean — Enables fault injection and allows for fault injection requests to be accepted from the task's containers.

  **Default:** undefined - ECS default setting is false

  Fault injection only works with tasks using the {@link NetworkMode.AWS_VPC} or {@link NetworkMode.HOST} network modes.

- `executionRole`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — The name of the IAM task execution role that grants the ECS agent permission to call AWS APIs on your behalf.

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

  The role will be used to retrieve container images from ECR and create CloudWatch log groups.

- `family`: string — The name of a family that this task definition is registered to.

  **Default:** Automatically generated name.

  A family groups multiple versions of a task definition.

- `proxyConfiguration`: [ProxyConfiguration](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.ProxyConfiguration.html) — The configuration details for the App Mesh proxy.

  **Default:** No proxy configuration.

- `taskRole`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — 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.

- `volumes`: [Volume](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.Volume.html)[] — The list of volume definitions for the task.

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

  For more information, see
  [Task Definition Parameter Volumes](https://docs.aws.amazon.com/AmazonECS/latest/developerguide//task_definition_parameters.html#volumes).
