Skip to content
v2.273.0

IEc2TaskDefinition Interface ​

The interface of a task definition run on an EC2 cluster.

Properties ​

compatibilityCompatibilitycompatibilityCompatibilitycompatibilityCompatibilityCompatibilityCompatibilityCompatibilityCompatibilityrequired#
What launch types this task definition should be compatible with.
The environment this resource belongs to.
notes

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.

executionRoleIRoleexecution_roleIRoleexecutionRoleIRoleExecutionRoleIRoleExecutionRoleIRole#
Execution role for this task definition.
isEc2Compatiblebooleanis_ec2_compatibleboolisEc2CompatibleBooleanIsEc2CompatibleboolIsEc2Compatible*boolrequired#
Return true if the task definition can be run on an EC2 cluster.
isExternalCompatiblebooleanis_external_compatibleboolisExternalCompatibleBooleanIsExternalCompatibleboolIsExternalCompatible*boolrequired#
Return true if the task definition can be run on a ECS Anywhere cluster.
isFargateCompatiblebooleanis_fargate_compatibleboolisFargateCompatibleBooleanIsFargateCompatibleboolIsFargateCompatible*boolrequired#
Return true if the task definition can be run on a Fargate cluster.
isManagedInstancesCompatiblebooleanis_managed_instances_compatibleboolisManagedInstancesCompatibleBooleanIsManagedInstancesCompatibleboolIsManagedInstancesCompatible*boolrequired#
Return true if the task definition can be run on Managed Instances.
networkModeNetworkModenetwork_modeNetworkModenetworkModeNetworkModeNetworkModeNetworkModeNetworkModeNetworkModerequired#
The networking mode to use for the containers in the task.
nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this resource is defined.
taskDefinitionArnstringtask_definition_arnstrtaskDefinitionArnStringTaskDefinitionArnstringTaskDefinitionArn*stringrequired#
ARN of this task definition.
taskDefinitionRefTaskDefinitionReferencetask_definition_refTaskDefinitionReferencetaskDefinitionRefTaskDefinitionReferenceTaskDefinitionRefTaskDefinitionReferenceTaskDefinitionRefTaskDefinitionReferencerequired#
A reference to a TaskDefinition resource.
taskRoleIRoletask_roleIRoletaskRoleIRoleTaskRoleIRoleTaskRoleIRolerequired#
The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.

Methods ​

applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#
Apply the given removal policy to this resource.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.

1 parameter · returns

Parameters

  • mixinsmixinsmixinsmixinsMixins — The mixins to apply.

Returns: This construct for chaining