CommonTaskDefinitionAttributes Struct
The common task definition attributes used across all types of task definitions.
| Source | aws-ecs/lib/base/task-definition.ts |
|---|---|
| Type last changed |
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 role: iam.Role;
const commonTaskDefinitionAttributes: ecs.CommonTaskDefinitionAttributes = {
taskDefinitionArn: 'taskDefinitionArn',
// the properties below are optional
executionRole: role,
networkMode: ecs.NetworkMode.NONE,
taskRole: role,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ecs as ecs
from aws_cdk import aws_iam as iam
# role: iam.Role
common_task_definition_attributes = ecs.CommonTaskDefinitionAttributes(
task_definition_arn="taskDefinitionArn",
# the properties below are optional
execution_role=role,
network_mode=ecs.NetworkMode.NONE,
task_role=role
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ecs.*;
import software.amazon.awscdk.services.iam.*;
Role role;
CommonTaskDefinitionAttributes commonTaskDefinitionAttributes = CommonTaskDefinitionAttributes.builder()
.taskDefinitionArn("taskDefinitionArn")
// the properties below are optional
.executionRole(role)
.networkMode(NetworkMode.NONE)
.taskRole(role)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ECS;
using Amazon.CDK.AWS.IAM;
Role role;
var commonTaskDefinitionAttributes = new CommonTaskDefinitionAttributes {
TaskDefinitionArn = "taskDefinitionArn",
// the properties below are optional
ExecutionRole = role,
NetworkMode = NetworkMode.NONE,
TaskRole = role
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var role Role
commonTaskDefinitionAttributes := &CommonTaskDefinitionAttributes{
TaskDefinitionArn: jsii.String("taskDefinitionArn"),
// the properties below are optional
ExecutionRole: role,
NetworkMode: awscdk.Aws_ecs.NetworkMode_NONE,
TaskRole: role,
}
Properties
executionRoleoptionalIRoleexecution_roleoptionalIRoleexecutionRoleoptionalIRoleExecutionRoleoptionalIRoleExecutionRoleoptionalIRole = 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.
networkModeoptionalNetworkModenetwork_modeoptionalNetworkModenetworkModeoptionalNetworkModeNetworkModeoptionalNetworkModeNetworkModeoptionalNetworkMode #The networking mode to use for the containers in the task.
Default: Network mode cannot be provided to the imported task.
taskDefinitionArnstringtask_definition_arnstrtaskDefinitionArnStringTaskDefinitionArnstringTaskDefinitionArn*string required #The arn of the task definition.