CommonTaskDefinitionProps Struct
The common properties for all task definitions.
For more information, see Task Definition Parameters.
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 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',
},
}],
};
# 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
# proxy_configuration: ecs.ProxyConfiguration
# role: iam.Role
common_task_definition_props = ecs.CommonTaskDefinitionProps(
enable_fault_injection=False,
execution_role=role,
family="family",
proxy_configuration=proxy_configuration,
task_role=role,
volumes=[ecs.Volume(
name="name",
# the properties below are optional
configured_at_launch=False,
docker_volume_configuration=ecs.DockerVolumeConfiguration(
driver="driver",
scope=ecs.Scope.TASK,
# the properties below are optional
autoprovision=False,
driver_opts={
"driver_opts_key": "driverOpts"
},
labels={
"labels_key": "labels"
}
),
efs_volume_configuration=ecs.EfsVolumeConfiguration(
file_system_id="fileSystemId",
# the properties below are optional
authorization_config=ecs.AuthorizationConfig(
access_point_id="accessPointId",
iam="iam"
),
root_directory="rootDirectory",
transit_encryption="transitEncryption",
transit_encryption_port=123
),
host=ecs.Host(
source_path="sourcePath"
)
)]
)
// 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.*;
ProxyConfiguration proxyConfiguration;
Role role;
CommonTaskDefinitionProps commonTaskDefinitionProps = CommonTaskDefinitionProps.builder()
.enableFaultInjection(false)
.executionRole(role)
.family("family")
.proxyConfiguration(proxyConfiguration)
.taskRole(role)
.volumes(List.of(Volume.builder()
.name("name")
// the properties below are optional
.configuredAtLaunch(false)
.dockerVolumeConfiguration(DockerVolumeConfiguration.builder()
.driver("driver")
.scope(Scope.TASK)
// the properties below are optional
.autoprovision(false)
.driverOpts(Map.of(
"driverOptsKey", "driverOpts"))
.labels(Map.of(
"labelsKey", "labels"))
.build())
.efsVolumeConfiguration(EfsVolumeConfiguration.builder()
.fileSystemId("fileSystemId")
// the properties below are optional
.authorizationConfig(AuthorizationConfig.builder()
.accessPointId("accessPointId")
.iam("iam")
.build())
.rootDirectory("rootDirectory")
.transitEncryption("transitEncryption")
.transitEncryptionPort(123)
.build())
.host(Host.builder()
.sourcePath("sourcePath")
.build())
.build()))
.build();
// 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;
ProxyConfiguration proxyConfiguration;
Role role;
var commonTaskDefinitionProps = new CommonTaskDefinitionProps {
EnableFaultInjection = false,
ExecutionRole = role,
Family = "family",
ProxyConfiguration = proxyConfiguration,
TaskRole = role,
Volumes = new [] { new Volume {
Name = "name",
// the properties below are optional
ConfiguredAtLaunch = false,
DockerVolumeConfiguration = new DockerVolumeConfiguration {
Driver = "driver",
Scope = Scope.TASK,
// the properties below are optional
Autoprovision = false,
DriverOpts = new Dictionary<string, string> {
{ "driverOptsKey", "driverOpts" }
},
Labels = new Dictionary<string, string> {
{ "labelsKey", "labels" }
}
},
EfsVolumeConfiguration = new EfsVolumeConfiguration {
FileSystemId = "fileSystemId",
// the properties below are optional
AuthorizationConfig = new AuthorizationConfig {
AccessPointId = "accessPointId",
Iam = "iam"
},
RootDirectory = "rootDirectory",
TransitEncryption = "transitEncryption",
TransitEncryptionPort = 123
},
Host = new Host {
SourcePath = "sourcePath"
}
} }
};
// 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 proxyConfiguration ProxyConfiguration
var role Role
commonTaskDefinitionProps := &CommonTaskDefinitionProps{
EnableFaultInjection: jsii.Boolean(false),
ExecutionRole: role,
Family: jsii.String("family"),
ProxyConfiguration: proxyConfiguration,
TaskRole: role,
Volumes: []Volume{
&Volume{
Name: jsii.String("name"),
// the properties below are optional
ConfiguredAtLaunch: jsii.Boolean(false),
DockerVolumeConfiguration: &DockerVolumeConfiguration{
Driver: jsii.String("driver"),
Scope: awscdk.Aws_ecs.Scope_TASK,
// the properties below are optional
Autoprovision: jsii.Boolean(false),
DriverOpts: map[string]*string{
"driverOptsKey": jsii.String("driverOpts"),
},
Labels: map[string]*string{
"labelsKey": jsii.String("labels"),
},
},
EfsVolumeConfiguration: &EfsVolumeConfiguration{
FileSystemId: jsii.String("fileSystemId"),
// the properties below are optional
AuthorizationConfig: &AuthorizationConfig{
AccessPointId: jsii.String("accessPointId"),
Iam: jsii.String("iam"),
},
RootDirectory: jsii.String("rootDirectory"),
TransitEncryption: jsii.String("transitEncryption"),
TransitEncryptionPort: jsii.Number(123),
},
Host: &Host{
SourcePath: jsii.String("sourcePath"),
},
},
},
}
Properties
enableFaultInjectionoptionalbooleanenable_fault_injectionoptionalboolenableFaultInjectionoptionalBooleanEnableFaultInjectionoptionalboolEnableFaultInjectionoptional*bool#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.
executionRoleoptionalIRoleexecution_roleoptionalIRoleexecutionRoleoptionalIRoleExecutionRoleoptionalIRoleExecutionRoleoptionalIRole#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.
Default: Automatically generated name.
A family groups multiple versions of a task definition.
proxyConfigurationoptionalProxyConfigurationproxy_configurationoptionalProxyConfigurationproxyConfigurationoptionalProxyConfigurationProxyConfigurationoptionalProxyConfigurationProxyConfigurationoptionalProxyConfiguration#Default: No proxy configuration.
taskRoleoptionalIRoletask_roleoptionalIRoletaskRoleoptionalIRoleTaskRoleoptionalIRoleTaskRoleoptionalIRole#Default: A task role is automatically created for you.
volumesoptionalVolume[]volumesoptionaltyping.List[Volume]volumesoptionalList<Volume>VolumesoptionalVolume[]Volumesoptional*[]Volume#Default: No volumes are passed to the Docker daemon on a container instance.
For more information, see Task Definition Parameter Volumes.