aws-cdk-lib.aws_ecs.TaskDefinitionAttributes

interface TaskDefinitionAttributes

LanguageType name
.NETAmazon.CDK.AWS.ECS.TaskDefinitionAttributes
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsecs#TaskDefinitionAttributes
Javasoftware.amazon.awscdk.services.ecs.TaskDefinitionAttributes
Pythonaws_cdk.aws_ecs.TaskDefinitionAttributes
TypeScript (source)aws-cdk-lib » aws_ecs » TaskDefinitionAttributes

A reference to an existing task definition.

Example

// 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 role: iam.Role;
const taskDefinitionAttributes: ecs.TaskDefinitionAttributes = {
  taskDefinitionArn: 'taskDefinitionArn',

  // the properties below are optional
  compatibility: ecs.Compatibility.EC2,
  executionRole: role,
  networkMode: ecs.NetworkMode.NONE,
  taskRole: role,
};

Properties

NameTypeDescription
taskDefinitionArnstringThe arn of the task definition.
compatibility?CompatibilityWhat launch types this task definition should be compatible with.
executionRole?IRoleThe IAM role that grants containers and Fargate agents permission to make AWS API calls on your behalf.
networkMode?NetworkModeThe networking mode to use for the containers in the task.
taskRole?IRoleThe name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.

taskDefinitionArn

Type: string

The arn of the task definition.


compatibility?

Type: Compatibility (optional, default: Compatibility.EC2_AND_FARGATE)

What launch types this task definition should be compatible with.


executionRole?

Type: IRole (optional, default: undefined)

The IAM role that grants containers and Fargate agents permission to make AWS API calls on your behalf.

Some tasks do not have an execution role.


networkMode?

Type: NetworkMode (optional, default: Network mode cannot be provided to the imported task.)

The networking mode to use for the containers in the task.


taskRole?

Type: IRole (optional, default: Permissions cannot be granted to the imported task.)

The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.