# ExternalTaskDefinitionProps

The properties for a task definition run on an External cluster.

Extends: ExternalTaskDefinitionProps
Extends: CommonTaskDefinitionProps
Used as props by: ExternalTaskDefinition

- Source: [`aws-ecs/lib/external/external-task-definition.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ecs/lib/external/external-task-definition.ts#L22)
- Type last changed: v2.28.0 · 14 Jun 2022

## 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 externalTaskDefinitionProps: ecs.ExternalTaskDefinitionProps = {
  enableFaultInjection: false,
  executionRole: role,
  family: 'family',
  networkMode: ecs.NetworkMode.NONE,
  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.

- `networkMode`: [NetworkMode](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.NetworkMode.html) = NetworkMode.BRIDGE — The networking mode to use for the containers in the task.

  With ECS Anywhere, supported modes are bridge, host and none.

- `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).
