@aws-cdk/aws-ecs
- Version 1.204.0
- Published
- 5.57 MB
- 26 dependencies
- Apache-2.0 license
Install
npm i @aws-cdk/aws-ecs
yarn add @aws-cdk/aws-ecs
pnpm add @aws-cdk/aws-ecs
Overview
The CDK Construct Library for AWS::ECS
Index
Functions
Classes
BaseService
- associateCloudMapService()
- attachToApplicationTargetGroup()
- attachToClassicLB()
- attachToNetworkTargetGroup()
- autoScaleTaskCount()
- cloudmapService
- cloudMapService
- cluster
- configureAwsVpcNetworking()
- configureAwsVpcNetworkingWithSecurityGroups()
- connections
- enableCloudMap()
- fromServiceArnWithCluster()
- loadBalancers
- loadBalancerTarget()
- metric()
- metricCpuUtilization()
- metricMemoryUtilization()
- networkConfiguration
- registerLoadBalancerTargets()
- serviceArn
- serviceName
- serviceRegistries
- taskDefinition
CfnService
- attrName
- attrServiceArn
- capacityProviderStrategy
- CFN_RESOURCE_TYPE_NAME
- cfnProperties
- cluster
- deploymentConfiguration
- deploymentController
- desiredCount
- enableEcsManagedTags
- enableExecuteCommand
- healthCheckGracePeriodSeconds
- inspect()
- launchType
- loadBalancers
- networkConfiguration
- placementConstraints
- placementStrategies
- platformVersion
- propagateTags
- renderProperties()
- role
- schedulingStrategy
- serviceConnectConfiguration
- serviceName
- serviceRegistries
- tags
- taskDefinition
Cluster
- addAsgCapacityProvider()
- addAutoScalingGroup()
- addCapacity()
- addCapacityProvider()
- addDefaultCloudMapNamespace()
- autoscalingGroup
- clusterArn
- clusterName
- connections
- defaultCloudMapNamespace
- enableFargateCapacityProviders()
- executeCommandConfiguration
- fromClusterArn()
- fromClusterAttributes()
- hasEc2Capacity
- metric()
- metricCpuReservation()
- metricCpuUtilization()
- metricMemoryReservation()
- metricMemoryUtilization()
- vpc
ContainerDefinition
- addContainerDependencies()
- addEnvironment()
- addInferenceAcceleratorResource()
- addLink()
- addMountPoints()
- addPortMappings()
- addScratch()
- addToExecutionPolicy()
- addUlimits()
- addVolumesFrom()
- containerDependencies
- containerName
- containerPort
- environmentFiles
- essential
- findPortMapping()
- imageName
- ingressPort
- linuxParameters
- logDriverConfig
- memoryLimitSpecified
- mountPoints
- portMappings
- referencesSecretJsonField
- renderContainerDefinition()
- taskDefinition
- ulimits
- volumesFrom
TaskDefinition
- addContainer()
- addExtension()
- addFirelensLogRouter()
- addInferenceAccelerator()
- addPlacementConstraint()
- addToExecutionRolePolicy()
- addToTaskRolePolicy()
- addVolume()
- compatibility
- containers
- defaultContainer
- ephemeralStorageGiB
- executionRole
- family
- findContainer()
- fromTaskDefinitionArn()
- fromTaskDefinitionAttributes()
- inferenceAccelerators
- networkMode
- obtainExecutionRole()
- referencesSecretJsonField
- taskDefinitionArn
- taskRole
- validate()
Interfaces
CfnServiceProps
- capacityProviderStrategy
- cluster
- deploymentConfiguration
- deploymentController
- desiredCount
- enableEcsManagedTags
- enableExecuteCommand
- healthCheckGracePeriodSeconds
- launchType
- loadBalancers
- networkConfiguration
- placementConstraints
- placementStrategies
- platformVersion
- propagateTags
- role
- schedulingStrategy
- serviceConnectConfiguration
- serviceName
- serviceRegistries
- tags
- taskDefinition
ContainerDefinitionOptions
- command
- containerName
- cpu
- disableNetworking
- dnsSearchDomains
- dnsServers
- dockerLabels
- dockerSecurityOptions
- entryPoint
- environment
- environmentFiles
- essential
- extraHosts
- gpuCount
- healthCheck
- hostname
- image
- inferenceAcceleratorResources
- linuxParameters
- logging
- memoryLimitMiB
- memoryReservationMiB
- portMappings
- privileged
- readonlyRootFilesystem
- secrets
- startTimeout
- stopTimeout
- systemControls
- user
- workingDirectory
Enums
Capability
- ALL
- AUDIT_CONTROL
- AUDIT_WRITE
- BLOCK_SUSPEND
- CHOWN
- DAC_OVERRIDE
- DAC_READ_SEARCH
- FOWNER
- FSETID
- IPC_LOCK
- IPC_OWNER
- KILL
- LEASE
- LINUX_IMMUTABLE
- MAC_ADMIN
- MAC_OVERRIDE
- MKNOD
- NET_ADMIN
- NET_BIND_SERVICE
- NET_BROADCAST
- NET_RAW
- SETFCAP
- SETGID
- SETPCAP
- SETUID
- SYS_ADMIN
- SYS_BOOT
- SYS_CHROOT
- SYS_MODULE
- SYS_NICE
- SYS_PACCT
- SYS_PTRACE
- SYS_RAWIO
- SYS_RESOURCE
- SYS_TIME
- SYS_TTY_CONFIG
- SYSLOG
- WAKE_ALARM
Namespaces
CfnService
- AwsVpcConfigurationProperty
- CapacityProviderStrategyItemProperty
- DeploymentAlarmsProperty
- DeploymentCircuitBreakerProperty
- DeploymentConfigurationProperty
- DeploymentControllerProperty
- LoadBalancerProperty
- LogConfigurationProperty
- NetworkConfigurationProperty
- PlacementConstraintProperty
- PlacementStrategyProperty
- SecretProperty
- ServiceConnectClientAliasProperty
- ServiceConnectConfigurationProperty
- ServiceConnectServiceProperty
- ServiceRegistryProperty
CfnTaskDefinition
- AuthorizationConfigProperty
- ContainerDefinitionProperty
- ContainerDependencyProperty
- DeviceProperty
- DockerVolumeConfigurationProperty
- EFSVolumeConfigurationProperty
- EnvironmentFileProperty
- EphemeralStorageProperty
- FirelensConfigurationProperty
- HealthCheckProperty
- HostEntryProperty
- HostVolumePropertiesProperty
- InferenceAcceleratorProperty
- KernelCapabilitiesProperty
- KeyValuePairProperty
- LinuxParametersProperty
- LogConfigurationProperty
- MountPointProperty
- PortMappingProperty
- ProxyConfigurationProperty
- RepositoryCredentialsProperty
- ResourceRequirementProperty
- RuntimePlatformProperty
- SecretProperty
- SystemControlProperty
- TaskDefinitionPlacementConstraintProperty
- TmpfsProperty
- UlimitProperty
- VolumeFromProperty
- VolumeProperty
Functions
function isEc2Compatible
isEc2Compatible: (compatibility: Compatibility) => boolean;
Return true if the given task definition can be run on an EC2 cluster
function isExternalCompatible
isExternalCompatible: (compatibility: Compatibility) => boolean;
Return true if the given task definition can be run on a ECS Anywhere cluster
function isFargateCompatible
isFargateCompatible: (compatibility: Compatibility) => boolean;
Return true if the given task definition can be run on a Fargate cluster
function obtainDefaultFluentBitECRImage
obtainDefaultFluentBitECRImage: ( task: TaskDefinition, logDriverConfig?: LogDriverConfig, imageTag?: string) => ContainerImage;
Obtain Fluent Bit image in Amazon ECR and setup corresponding IAM permissions. ECR image pull permissions will be granted in task execution role. Cloudwatch logs, Kinesis data stream or firehose permissions will be grant by check options in logDriverConfig. https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_firelens.html#firelens-using-fluentbit
Classes
class AppMeshProxyConfiguration
class AppMeshProxyConfiguration extends ProxyConfiguration {}
The class for App Mesh proxy configurations.
For tasks using the EC2 launch type, the container instances require at least version 1.26.0 of the container agent and at least version 1.26.0-1 of the ecs-init package to enable a proxy configuration. If your container instances are launched from the Amazon ECS-optimized AMI version 20190301 or later, then they contain the required versions of the container agent and ecs-init. For more information, see [Amazon ECS-optimized AMIs](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html).
For tasks using the Fargate launch type, the task or service requires platform version 1.3.0 or later.
constructor
constructor(props: AppMeshProxyConfigurationConfigProps);
Constructs a new instance of the AppMeshProxyConfiguration class.
method bind
bind: ( _scope: CoreConstruct, _taskDefinition: TaskDefinition) => CfnTaskDefinition.ProxyConfigurationProperty;
Called when the proxy configuration is configured on a task definition.
class AsgCapacityProvider
class AsgCapacityProvider extends CoreConstruct {}
An Auto Scaling Group Capacity Provider. This allows an ECS cluster to target a specific EC2 Auto Scaling Group for the placement of tasks. Optionally (and recommended), ECS can manage the number of instances in the ASG to fit the tasks, and can ensure that instances are not prematurely terminated while there are still tasks running on them.
constructor
constructor(scope: Construct, id: string, props: AsgCapacityProviderProps);
property autoScalingGroup
readonly autoScalingGroup: autoscaling.AutoScalingGroup;
Auto Scaling Group
property canContainersAccessInstanceRole
readonly canContainersAccessInstanceRole?: boolean;
Specifies whether the containers can access the container instance role.
false
property capacityProviderName
readonly capacityProviderName: string;
Capacity provider name Chosen by CloudFormation
property enableManagedTerminationProtection
readonly enableManagedTerminationProtection?: boolean;
Whether managed termination protection is enabled
property machineImageType
readonly machineImageType: MachineImageType;
Auto Scaling Group machineImageType.
class AssetEnvironmentFile
class AssetEnvironmentFile extends EnvironmentFile {}
Environment file from a local directory.
constructor
constructor(path: string, options?: AssetOptions);
Parameter path
The path to the asset file or directory.
Parameter options
property path
readonly path: string;
method bind
bind: (scope: Construct) => EnvironmentFileConfig;
class AssetImage
class AssetImage extends ContainerImage {}
An image that will be built from a local directory with a Dockerfile
constructor
constructor(directory: string, props?: AssetImageProps);
Constructs a new instance of the AssetImage class.
Parameter directory
The directory containing the Dockerfile
method bind
bind: ( scope: CoreConstruct, containerDefinition: ContainerDefinition) => ContainerImageConfig;
class AwsLogDriver
class AwsLogDriver extends LogDriver {}
A log driver that sends log information to CloudWatch Logs.
constructor
constructor(props: AwsLogDriverProps);
Constructs a new instance of the AwsLogDriver class.
Parameter props
the awslogs log driver configuration options.
property logGroup
logGroup?: logs.ILogGroup;
The log group to send log streams to.
Only available after the LogDriver has been bound to a ContainerDefinition.
method bind
bind: ( scope: CoreConstruct, containerDefinition: ContainerDefinition) => LogDriverConfig;
Called when the log driver is configured on a container
class BaseService
abstract class BaseService extends Resource implements IBaseService, elbv2.IApplicationLoadBalancerTarget, elbv2.INetworkLoadBalancerTarget, elb.ILoadBalancerTarget {}
The base class for Ec2Service and FargateService services.
constructor
constructor( scope: Construct, id: string, props: BaseServiceProps, additionalProps: any, taskDefinition: TaskDefinition);
Constructs a new instance of the BaseService class.
property cloudmapService
protected cloudmapService?: cloudmap.Service;
The details of the AWS Cloud Map service.
property cloudMapService
readonly cloudMapService: any;
The CloudMap service created for this service, if any.
property cluster
readonly cluster: ICluster;
The cluster that hosts the service.
property connections
readonly connections: ec2.Connections;
The security groups which manage the allowed network traffic for the service.
property loadBalancers
protected loadBalancers: CfnService.LoadBalancerProperty[];
A list of Elastic Load Balancing load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.
property networkConfiguration
protected networkConfiguration?: CfnService.NetworkConfigurationProperty;
A list of Elastic Load Balancing load balancer objects, containing the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer.
property serviceArn
readonly serviceArn: string;
The Amazon Resource Name (ARN) of the service.
property serviceName
readonly serviceName: string;
The name of the service.
property serviceRegistries
protected serviceRegistries: CfnService.ServiceRegistryProperty[];
The details of the service discovery registries to assign to this service. For more information, see Service Discovery.
property taskDefinition
readonly taskDefinition: TaskDefinition;
The task definition to use for tasks in the service.
method associateCloudMapService
associateCloudMapService: (options: AssociateCloudMapServiceOptions) => void;
Associates this service with a CloudMap service
method attachToApplicationTargetGroup
attachToApplicationTargetGroup: ( targetGroup: elbv2.IApplicationTargetGroup) => elbv2.LoadBalancerTargetProps;
This method is called to attach this service to an Application Load Balancer.
Don't call this function directly. Instead, call
listener.addTargets()
to add this service to a load balancer.
method attachToClassicLB
attachToClassicLB: (loadBalancer: elb.LoadBalancer) => void;
Registers the service as a target of a Classic Load Balancer (CLB).
Don't call this. Call
loadBalancer.addTarget()
instead.
method attachToNetworkTargetGroup
attachToNetworkTargetGroup: ( targetGroup: elbv2.INetworkTargetGroup) => elbv2.LoadBalancerTargetProps;
This method is called to attach this service to a Network Load Balancer.
Don't call this function directly. Instead, call
listener.addTargets()
to add this service to a load balancer.
method autoScaleTaskCount
autoScaleTaskCount: (props: appscaling.EnableScalingProps) => ScalableTaskCount;
An attribute representing the minimum and maximum task count for an AutoScalingGroup.
method configureAwsVpcNetworking
protected configureAwsVpcNetworking: ( vpc: ec2.IVpc, assignPublicIp?: boolean, vpcSubnets?: ec2.SubnetSelection, securityGroup?: ec2.ISecurityGroup) => void;
This method is called to create a networkConfiguration.
Deprecated
use configureAwsVpcNetworkingWithSecurityGroups instead.
method configureAwsVpcNetworkingWithSecurityGroups
protected configureAwsVpcNetworkingWithSecurityGroups: ( vpc: ec2.IVpc, assignPublicIp?: boolean, vpcSubnets?: ec2.SubnetSelection, securityGroups?: ec2.ISecurityGroup[]) => void;
This method is called to create a networkConfiguration.
method enableCloudMap
enableCloudMap: (options: CloudMapOptions) => cloudmap.Service;
Enable CloudMap service discovery for the service
Returns
The created CloudMap service
method fromServiceArnWithCluster
static fromServiceArnWithCluster: ( scope: Construct, id: string, serviceArn: string) => IBaseService;
Import an existing ECS/Fargate Service using the service cluster format. The format is the "new" format "arn:aws:ecs:region:aws_account_id:service/cluster-name/service-name".
See Also
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids
method loadBalancerTarget
loadBalancerTarget: ( options: LoadBalancerTargetOptions) => IEcsLoadBalancerTarget;
Return a load balancing target for a specific container and port.
Use this function to create a load balancer target if you want to load balance to another container than the first essential container or the first mapped port on the container.
Use the return value of this function where you would normally use a load balancer target, instead of the
Service
object itself.Example 1
declare const listener: elbv2.ApplicationListener; declare const service: ecs.BaseService; listener.addTargets('ECS', { port: 80, targets: [service.loadBalancerTarget({ containerName: 'MyContainer', containerPort: 1234, })], });
method metric
metric: ( metricName: string, props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
This method returns the specified CloudWatch metric name for this service.
method metricCpuUtilization
metricCpuUtilization: (props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
This method returns the CloudWatch metric for this service's CPU utilization.
average over 5 minutes
method metricMemoryUtilization
metricMemoryUtilization: (props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
This method returns the CloudWatch metric for this service's memory utilization.
average over 5 minutes
method registerLoadBalancerTargets
registerLoadBalancerTargets: (...targets: EcsTarget[]) => void;
Use this function to create all load balancer targets to be registered in this service, add them to target groups, and attach target groups to listeners accordingly.
Alternatively, you can use
listener.addTargets()
to create targets and add them to target groups.Example 1
declare const listener: elbv2.ApplicationListener; declare const service: ecs.BaseService; service.registerLoadBalancerTargets( { containerName: 'web', containerPort: 80, newTargetGroupId: 'ECS', listener: ecs.ListenerConfig.applicationListener(listener, { protocol: elbv2.ApplicationProtocol.HTTPS }), }, )
class BottleRocketImage
class BottleRocketImage implements ec2.IMachineImage {}
Construct an Bottlerocket image from the latest AMI published in SSM
constructor
constructor(props?: BottleRocketImageProps);
Constructs a new instance of the BottleRocketImage class.
method getImage
getImage: (scope: CoreConstruct) => ec2.MachineImageConfig;
Return the correct image
class BuiltInAttributes
class BuiltInAttributes {}
The built-in container instance attributes
property AMI_ID
static readonly AMI_ID: string;
The AMI id the instance is using.
property AVAILABILITY_ZONE
static readonly AVAILABILITY_ZONE: string;
The AvailabilityZone where the instance is running in.
property INSTANCE_ID
static readonly INSTANCE_ID: string;
The id of the instance.
property INSTANCE_TYPE
static readonly INSTANCE_TYPE: string;
The EC2 instance type.
property OS_TYPE
static readonly OS_TYPE: string;
The operating system of the instance.
Either 'linux' or 'windows'.
class CfnCapacityProvider
class CfnCapacityProvider extends cdk.CfnResource implements cdk.IInspectable {}
A CloudFormation
AWS::ECS::CapacityProvider
Creates a new capacity provider. Capacity providers are associated with an Amazon ECS cluster and are used in capacity provider strategies to facilitate cluster auto scaling.
Only capacity providers that use an Auto Scaling group can be created. Amazon ECS tasks on AWS Fargate use the
FARGATE
andFARGATE_SPOT
capacity providers. These providers are available to all accounts in the AWS Regions that AWS Fargate supports.AWS::ECS::CapacityProvider external
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-capacityprovider.html
constructor
constructor(scope: cdk.Construct, id: string, props: CfnCapacityProviderProps);
Create a new
AWS::ECS::CapacityProvider
.Parameter scope
scope in which this resource is defined
Parameter id
scoped id of the resource
Parameter props
resource properties
property autoScalingGroupProvider
autoScalingGroupProvider: any;
The Auto Scaling group settings for the capacity provider.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-capacityprovider.html#cfn-ecs-capacityprovider-autoscalinggroupprovider
property CFN_RESOURCE_TYPE_NAME
static readonly CFN_RESOURCE_TYPE_NAME: string;
The CloudFormation resource type name for this resource class.
property cfnProperties
readonly cfnProperties: { [key: string]: any };
property name
name: string;
The name of the capacity provider. If a name is specified, it cannot start with
aws
,ecs
, orfargate
. If no name is specified, a default name in theCFNStackName-CFNResourceName-RandomString
format is used.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-capacityprovider.html#cfn-ecs-capacityprovider-name
property tags
readonly tags: cdk.TagManager;
The metadata that you apply to the capacity provider to help you categorize and organize it. Each tag consists of a key and an optional value. You define both.
The following basic restrictions apply to tags:
- Maximum number of tags per resource - 50 - For each resource, each tag key must be unique, and each tag key can have only one value. - Maximum key length - 128 Unicode characters in UTF-8 - Maximum value length - 256 Unicode characters in UTF-8 - If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @. - Tag keys and values are case-sensitive. - Do not use
aws:
,AWS:
, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for AWS use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-capacityprovider.html#cfn-ecs-capacityprovider-tags
method inspect
inspect: (inspector: cdk.TreeInspector) => void;
Examines the CloudFormation resource and discloses attributes.
Parameter inspector
tree inspector to collect and process attributes
method renderProperties
protected renderProperties: (props: { [key: string]: any }) => { [key: string]: any;};
class CfnCluster
class CfnCluster extends cdk.CfnResource implements cdk.IInspectable {}
A CloudFormation
AWS::ECS::Cluster
The
AWS::ECS::Cluster
resource creates an Amazon Elastic Container Service (Amazon ECS) cluster.AWS::ECS::Cluster external
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-cluster.html
constructor
constructor(scope: cdk.Construct, id: string, props?: CfnClusterProps);
Create a new
AWS::ECS::Cluster
.Parameter scope
scope in which this resource is defined
Parameter id
scoped id of the resource
Parameter props
resource properties
property attrArn
readonly attrArn: string;
The Amazon Resource Name (ARN) of the Amazon ECS cluster, such as
arn:aws:ecs:us-east-2:123456789012:cluster/MyECSCluster
. Arn
property capacityProviders
capacityProviders: string[];
The short name of one or more capacity providers to associate with the cluster. A capacity provider must be associated with a cluster before it can be included as part of the default capacity provider strategy of the cluster or used in a capacity provider strategy when calling the [CreateService](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_CreateService.html) or [RunTask](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_RunTask.html) actions.
If specifying a capacity provider that uses an Auto Scaling group, the capacity provider must be created but not associated with another cluster. New Auto Scaling group capacity providers can be created with the [CreateCapacityProvider](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_CreateCapacityProvider.html) API operation.
To use a AWS Fargate capacity provider, specify either the
FARGATE
orFARGATE_SPOT
capacity providers. The AWS Fargate capacity providers are available to all accounts and only need to be associated with a cluster to be used.The [PutCapacityProvider](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_PutCapacityProvider.html) API operation is used to update the list of available capacity providers for a cluster after the cluster is created.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-cluster.html#cfn-ecs-cluster-capacityproviders
property CFN_RESOURCE_TYPE_NAME
static readonly CFN_RESOURCE_TYPE_NAME: string;
The CloudFormation resource type name for this resource class.
property cfnProperties
readonly cfnProperties: { [key: string]: any };
property clusterName
clusterName: string;
A user-generated string that you use to identify your cluster. If you don't specify a name, AWS CloudFormation generates a unique physical ID for the name.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-cluster.html#cfn-ecs-cluster-clustername
property clusterSettings
clusterSettings: any;
The settings to use when creating a cluster. This parameter is used to turn on CloudWatch Container Insights for a cluster.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-cluster.html#cfn-ecs-cluster-clustersettings
property configuration
configuration: any;
The execute command configuration for the cluster.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-cluster.html#cfn-ecs-cluster-configuration
property defaultCapacityProviderStrategy
defaultCapacityProviderStrategy: any;
The default capacity provider strategy for the cluster. When services or tasks are run in the cluster with no launch type or capacity provider strategy specified, the default capacity provider strategy is used.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-cluster.html#cfn-ecs-cluster-defaultcapacityproviderstrategy
property serviceConnectDefaults
serviceConnectDefaults: any;
Use this parameter to set a default Service Connect namespace. After you set a default Service Connect namespace, any new services with Service Connect turned on that are created in the cluster are added as client services in the namespace. This setting only applies to new services that set the
enabled
parameter totrue
in theServiceConnectConfiguration
. You can set the namespace of each service individually in theServiceConnectConfiguration
to override this default parameter.Tasks that run in a namespace can use short names to connect to services in the namespace. Tasks can connect to services across all of the clusters in the namespace. Tasks connect through a managed proxy container that collects logs and metrics for increased visibility. Only the tasks that Amazon ECS services create are supported with Service Connect. For more information, see [Service Connect](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-connect.html) in the *Amazon Elastic Container Service Developer Guide* .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-cluster.html#cfn-ecs-cluster-serviceconnectdefaults
property tags
readonly tags: cdk.TagManager;
The metadata that you apply to the cluster to help you categorize and organize them. Each tag consists of a key and an optional value. You define both.
The following basic restrictions apply to tags:
- Maximum number of tags per resource - 50 - For each resource, each tag key must be unique, and each tag key can have only one value. - Maximum key length - 128 Unicode characters in UTF-8 - Maximum value length - 256 Unicode characters in UTF-8 - If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @. - Tag keys and values are case-sensitive. - Do not use
aws:
,AWS:
, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for AWS use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-cluster.html#cfn-ecs-cluster-tags
method inspect
inspect: (inspector: cdk.TreeInspector) => void;
Examines the CloudFormation resource and discloses attributes.
Parameter inspector
tree inspector to collect and process attributes
method renderProperties
protected renderProperties: (props: { [key: string]: any }) => { [key: string]: any;};
class CfnClusterCapacityProviderAssociations
class CfnClusterCapacityProviderAssociations extends cdk.CfnResource implements cdk.IInspectable {}
A CloudFormation
AWS::ECS::ClusterCapacityProviderAssociations
The
AWS::ECS::ClusterCapacityProviderAssociations
resource associates one or more capacity providers and a default capacity provider strategy with a cluster.AWS::ECS::ClusterCapacityProviderAssociations external
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-clustercapacityproviderassociations.html
constructor
constructor( scope: cdk.Construct, id: string, props: CfnClusterCapacityProviderAssociationsProps);
Create a new
AWS::ECS::ClusterCapacityProviderAssociations
.Parameter scope
scope in which this resource is defined
Parameter id
scoped id of the resource
Parameter props
resource properties
property capacityProviders
capacityProviders: string[];
The capacity providers to associate with the cluster.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-clustercapacityproviderassociations.html#cfn-ecs-clustercapacityproviderassociations-capacityproviders
property CFN_RESOURCE_TYPE_NAME
static readonly CFN_RESOURCE_TYPE_NAME: string;
The CloudFormation resource type name for this resource class.
property cfnProperties
readonly cfnProperties: { [key: string]: any };
property cluster
cluster: string;
The cluster the capacity provider association is the target of.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-clustercapacityproviderassociations.html#cfn-ecs-clustercapacityproviderassociations-cluster
property defaultCapacityProviderStrategy
defaultCapacityProviderStrategy: any;
The default capacity provider strategy to associate with the cluster.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-clustercapacityproviderassociations.html#cfn-ecs-clustercapacityproviderassociations-defaultcapacityproviderstrategy
method inspect
inspect: (inspector: cdk.TreeInspector) => void;
Examines the CloudFormation resource and discloses attributes.
Parameter inspector
tree inspector to collect and process attributes
method renderProperties
protected renderProperties: (props: { [key: string]: any }) => { [key: string]: any;};
class CfnPrimaryTaskSet
class CfnPrimaryTaskSet extends cdk.CfnResource implements cdk.IInspectable {}
A CloudFormation
AWS::ECS::PrimaryTaskSet
Modifies which task set in a service is the primary task set. Any parameters that are updated on the primary task set in a service will transition to the service. This is used when a service uses the
EXTERNAL
deployment controller type. For more information, see [Amazon ECS Deployment Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html) in the *Amazon Elastic Container Service Developer Guide* .AWS::ECS::PrimaryTaskSet external
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-primarytaskset.html
constructor
constructor(scope: cdk.Construct, id: string, props: CfnPrimaryTaskSetProps);
Create a new
AWS::ECS::PrimaryTaskSet
.Parameter scope
scope in which this resource is defined
Parameter id
scoped id of the resource
Parameter props
resource properties
property CFN_RESOURCE_TYPE_NAME
static readonly CFN_RESOURCE_TYPE_NAME: string;
The CloudFormation resource type name for this resource class.
property cfnProperties
readonly cfnProperties: { [key: string]: any };
property cluster
cluster: string;
The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service that the task set exists in.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-primarytaskset.html#cfn-ecs-primarytaskset-cluster
property service
service: string;
The short name or full Amazon Resource Name (ARN) of the service that the task set exists in.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-primarytaskset.html#cfn-ecs-primarytaskset-service
property taskSetId
taskSetId: string;
The short name or full Amazon Resource Name (ARN) of the task set to set as the primary task set in the deployment.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-primarytaskset.html#cfn-ecs-primarytaskset-tasksetid
method inspect
inspect: (inspector: cdk.TreeInspector) => void;
Examines the CloudFormation resource and discloses attributes.
Parameter inspector
tree inspector to collect and process attributes
method renderProperties
protected renderProperties: (props: { [key: string]: any }) => { [key: string]: any;};
class CfnService
class CfnService extends cdk.CfnResource implements cdk.IInspectable {}
A CloudFormation
AWS::ECS::Service
The
AWS::ECS::Service
resource creates an Amazon Elastic Container Service (Amazon ECS) service that runs and maintains the requested number of tasks and associated load balancers.> The stack update fails if you change any properties that require replacement and at least one Amazon ECS Service Connect
ServiceConnectService
is configured. This is because AWS CloudFormation creates the replacement service first, but eachServiceConnectService
must have a name that is unique in the namespace. > Starting April 15, 2023, AWS ; will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS , or Amazon EC2 . However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service.AWS::ECS::Service external
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
constructor
constructor(scope: cdk.Construct, id: string, props?: CfnServiceProps);
Create a new
AWS::ECS::Service
.Parameter scope
scope in which this resource is defined
Parameter id
scoped id of the resource
Parameter props
resource properties
property attrName
readonly attrName: string;
The name of the Amazon ECS service, such as
sample-webapp
. Name
property attrServiceArn
readonly attrServiceArn: string;
Not currently supported in AWS CloudFormation . ServiceArn
property capacityProviderStrategy
capacityProviderStrategy: any;
The capacity provider strategy to use for the service.
If a
capacityProviderStrategy
is specified, thelaunchType
parameter must be omitted. If nocapacityProviderStrategy
orlaunchType
is specified, thedefaultCapacityProviderStrategy
for the cluster is used.A capacity provider strategy may contain a maximum of 6 capacity providers.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-capacityproviderstrategy
property CFN_RESOURCE_TYPE_NAME
static readonly CFN_RESOURCE_TYPE_NAME: string;
The CloudFormation resource type name for this resource class.
property cfnProperties
readonly cfnProperties: { [key: string]: any };
property cluster
cluster: string;
The short name or full Amazon Resource Name (ARN) of the cluster that you run your service on. If you do not specify a cluster, the default cluster is assumed.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-cluster
property deploymentConfiguration
deploymentConfiguration: any;
Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-deploymentconfiguration
property deploymentController
deploymentController: any;
The deployment controller to use for the service. If no deployment controller is specified, the default value of
ECS
is used.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-deploymentcontroller
property desiredCount
desiredCount: number;
The number of instantiations of the specified task definition to place and keep running in your service.
For new services, if a desired count is not specified, a default value of
1
is used. When using theDAEMON
scheduling strategy, the desired count is not required.For existing services, if a desired count is not specified, it is omitted from the operation.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-desiredcount
property enableEcsManagedTags
enableEcsManagedTags: any;
Specifies whether to turn on Amazon ECS managed tags for the tasks within the service. For more information, see [Tagging your Amazon ECS resources](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-using-tags.html) in the *Amazon Elastic Container Service Developer Guide* .
When you use Amazon ECS managed tags, you need to set the
propagateTags
request parameter.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-enableecsmanagedtags
property enableExecuteCommand
enableExecuteCommand: any;
Determines whether the execute command functionality is turned on for the service. If
true
, the execute command functionality is turned on for all containers in tasks as part of the service.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-enableexecutecommand
property healthCheckGracePeriodSeconds
healthCheckGracePeriodSeconds: number;
The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started. This is only used when your service is configured to use a load balancer. If your service has a load balancer defined and you don't specify a health check grace period value, the default value of
0
is used.If you do not use an Elastic Load Balancing, we recommend that you use the
startPeriod
in the task definition health check parameters. For more information, see [Health check](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_HealthCheck.html) .If your service's tasks take a while to start and respond to Elastic Load Balancing health checks, you can specify a health check grace period of up to 2,147,483,647 seconds (about 69 years). During that time, the Amazon ECS service scheduler ignores health check status. This grace period can prevent the service scheduler from marking tasks as unhealthy and stopping them before they have time to come up.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-healthcheckgraceperiodseconds
property launchType
launchType: string;
The launch type on which to run your service. For more information, see [Amazon ECS Launch Types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) in the *Amazon Elastic Container Service Developer Guide* .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-launchtype
property loadBalancers
loadBalancers: any;
A list of load balancer objects to associate with the service. If you specify the
Role
property,LoadBalancers
must be specified as well. For information about the number of load balancers that you can specify per service, see [Service Load Balancing](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-load-balancing.html) in the *Amazon Elastic Container Service Developer Guide* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-loadbalancers
property networkConfiguration
networkConfiguration: any;
The network configuration for the service. This parameter is required for task definitions that use the
awsvpc
network mode to receive their own elastic network interface, and it is not supported for other network modes. For more information, see [Task Networking](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html) in the *Amazon Elastic Container Service Developer Guide* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-networkconfiguration
property placementConstraints
placementConstraints: any;
An array of placement constraint objects to use for tasks in your service. You can specify a maximum of 10 constraints for each task. This limit includes constraints in the task definition and those specified at runtime.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-placementconstraints
property placementStrategies
placementStrategies: any;
The placement strategy objects to use for tasks in your service. You can specify a maximum of 5 strategy rules for each service.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-placementstrategies
property platformVersion
platformVersion: string;
The platform version that your tasks in the service are running on. A platform version is specified only for tasks using the Fargate launch type. If one isn't specified, the
LATEST
platform version is used. For more information, see [AWS Fargate platform versions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html) in the *Amazon Elastic Container Service Developer Guide* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-platformversion
property propagateTags
propagateTags: string;
Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags aren't propagated. Tags can only be propagated to the task during task creation. To add tags to a task after task creation, use the [TagResource](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_TagResource.html) API action.
The default is
NONE
.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-propagatetags
property role
role: string;
The name or full Amazon Resource Name (ARN) of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf. This parameter is only permitted if you are using a load balancer with your service and your task definition doesn't use the
awsvpc
network mode. If you specify therole
parameter, you must also specify a load balancer object with theloadBalancers
parameter.> If your account has already created the Amazon ECS service-linked role, that role is used for your service unless you specify a role here. The service-linked role is required if your task definition uses the
awsvpc
network mode or if the service is configured to use service discovery, an external deployment controller, multiple target groups, or Elastic Inference accelerators in which case you don't specify a role here. For more information, see [Using service-linked roles for Amazon ECS](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using-service-linked-roles.html) in the *Amazon Elastic Container Service Developer Guide* .If your specified role has a path other than
/
, then you must either specify the full role ARN (this is recommended) or prefix the role name with the path. For example, if a role with the namebar
has a path of/foo/
then you would specify/foo/bar
as the role name. For more information, see [Friendly names and paths](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-friendly-names) in the *IAM User Guide* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-role
property schedulingStrategy
schedulingStrategy: string;
The scheduling strategy to use for the service. For more information, see [Services](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html) .
There are two service scheduler strategies available:
-
REPLICA
-The replica scheduling strategy places and maintains the desired number of tasks across your cluster. By default, the service scheduler spreads tasks across Availability Zones. You can use task placement strategies and constraints to customize task placement decisions. This scheduler strategy is required if the service uses theCODE_DEPLOY
orEXTERNAL
deployment controller types. -DAEMON
-The daemon scheduling strategy deploys exactly one task on each active container instance that meets all of the task placement constraints that you specify in your cluster. The service scheduler also evaluates the task placement constraints for running tasks and will stop tasks that don't meet the placement constraints. When you're using this strategy, you don't need to specify a desired number of tasks, a task placement strategy, or use Service Auto Scaling policies.> Tasks using the Fargate launch type or the
CODE_DEPLOY
orEXTERNAL
deployment controller types don't support theDAEMON
scheduling strategy.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-schedulingstrategy
property serviceConnectConfiguration
serviceConnectConfiguration: any;
The configuration for this service to discover and connect to services, and be discovered by, and connected from, other services within a namespace.
Tasks that run in a namespace can use short names to connect to services in the namespace. Tasks can connect to services across all of the clusters in the namespace. Tasks connect through a managed proxy container that collects logs and metrics for increased visibility. Only the tasks that Amazon ECS services create are supported with Service Connect. For more information, see [Service Connect](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-connect.html) in the *Amazon Elastic Container Service Developer Guide* .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-serviceconnectconfiguration
property serviceName
serviceName: string;
The name of your service. Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed. Service names must be unique within a cluster, but you can have similarly named services in multiple clusters within a Region or across multiple Regions.
> The stack update fails if you change any properties that require replacement and the
ServiceName
is configured. This is because AWS CloudFormation creates the replacement service first, but eachServiceName
must be unique in the cluster.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-servicename
property serviceRegistries
serviceRegistries: any;
The details of the service discovery registry to associate with this service. For more information, see [Service discovery](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-discovery.html) .
> Each service may be associated with one service registry. Multiple service registries for each service isn't supported.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-serviceregistries
property tags
readonly tags: cdk.TagManager;
The metadata that you apply to the service to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. When a service is deleted, the tags are deleted as well.
The following basic restrictions apply to tags:
- Maximum number of tags per resource - 50 - For each resource, each tag key must be unique, and each tag key can have only one value. - Maximum key length - 128 Unicode characters in UTF-8 - Maximum value length - 256 Unicode characters in UTF-8 - If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @. - Tag keys and values are case-sensitive. - Do not use
aws:
,AWS:
, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for AWS use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-tags
property taskDefinition
taskDefinition: string;
The
family
andrevision
(family:revision
) or full ARN of the task definition to run in your service. If arevision
isn't specified, the latestACTIVE
revision is used.A task definition must be specified if the service uses either the
ECS
orCODE_DEPLOY
deployment controllers.For more information about deployment types, see [Amazon ECS deployment types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html) .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html#cfn-ecs-service-taskdefinition
method inspect
inspect: (inspector: cdk.TreeInspector) => void;
Examines the CloudFormation resource and discloses attributes.
Parameter inspector
tree inspector to collect and process attributes
method renderProperties
protected renderProperties: (props: { [key: string]: any }) => { [key: string]: any;};
class CfnTaskDefinition
class CfnTaskDefinition extends cdk.CfnResource implements cdk.IInspectable {}
A CloudFormation
AWS::ECS::TaskDefinition
The details of a task definition which describes the container and volume definitions of an Amazon Elastic Container Service task. You can specify which Docker images to use, the required resources, and other configurations related to launching the task definition through an Amazon ECS service or task.
AWS::ECS::TaskDefinition external
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html
constructor
constructor(scope: cdk.Construct, id: string, props?: CfnTaskDefinitionProps);
Create a new
AWS::ECS::TaskDefinition
.Parameter scope
scope in which this resource is defined
Parameter id
scoped id of the resource
Parameter props
resource properties
property attrTaskDefinitionArn
readonly attrTaskDefinitionArn: string;
TaskDefinitionArn
property CFN_RESOURCE_TYPE_NAME
static readonly CFN_RESOURCE_TYPE_NAME: string;
The CloudFormation resource type name for this resource class.
property cfnProperties
readonly cfnProperties: { [key: string]: any };
property containerDefinitions
containerDefinitions: any;
A list of container definitions in JSON format that describe the different containers that make up your task. For more information about container definition parameters and defaults, see [Amazon ECS Task Definitions](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_defintions.html) in the *Amazon Elastic Container Service Developer Guide* .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-containerdefinitions
property cpu
cpu: string;
The number of
cpu
units used by the task. If you use the EC2 launch type, this field is optional. Any value can be used. If you use the Fargate launch type, this field is required. You must use one of the following values. The value that you choose determines your range of valid values for thememory
parameter.The CPU units cannot be less than 1 vCPU when you use Windows containers on Fargate.
- 256 (.25 vCPU) - Available
memory
values: 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - 512 (.5 vCPU) - Availablememory
values: 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - 1024 (1 vCPU) - Availablememory
values: 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - 2048 (2 vCPU) - Availablememory
values: 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - 4096 (4 vCPU) - Availablememory
values: 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - 8192 (8 vCPU) - Availablememory
values: 16 GB and 60 GB in 4 GB incrementsThis option requires Linux platform
1.4.0
or later. - 16384 (16vCPU) - Availablememory
values: 32GB and 120 GB in 8 GB incrementsThis option requires Linux platform
1.4.0
or later.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-cpu
property ephemeralStorage
ephemeralStorage: any;
The ephemeral storage settings to use for tasks run with the task definition.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-ephemeralstorage
property executionRoleArn
executionRoleArn: string;
The Amazon Resource Name (ARN) of the task execution role that grants the Amazon ECS container agent permission to make AWS API calls on your behalf. The task execution IAM role is required depending on the requirements of your task. For more information, see [Amazon ECS task execution IAM role](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_execution_IAM_role.html) in the *Amazon Elastic Container Service Developer Guide* .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-executionrolearn
property family
family: string;
The name of a family that this task definition is registered to. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.
A family groups multiple versions of a task definition. Amazon ECS gives the first task definition that you registered to a family a revision number of 1. Amazon ECS gives sequential revision numbers to each task definition that you add.
> To use revision numbers when you update a task definition, specify this property. If you don't specify a value, AWS CloudFormation generates a new task definition each time that you update it.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-family
property inferenceAccelerators
inferenceAccelerators: any;
The Elastic Inference accelerators to use for the containers in the task.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-inferenceaccelerators
property ipcMode
ipcMode: string;
The IPC resource namespace to use for the containers in the task. The valid values are
host
,task
, ornone
. Ifhost
is specified, then all containers within the tasks that specified thehost
IPC mode on the same container instance share the same IPC resources with the host Amazon EC2 instance. Iftask
is specified, all containers within the specified task share the same IPC resources. Ifnone
is specified, then IPC resources within the containers of a task are private and not shared with other containers in a task or on the container instance. If no value is specified, then the IPC resource namespace sharing depends on the Docker daemon setting on the container instance. For more information, see [IPC settings](https://docs.aws.amazon.com/https://docs.docker.com/engine/reference/run/#ipc-settings---ipc) in the *Docker run reference* .If the
host
IPC mode is used, be aware that there is a heightened risk of undesired IPC namespace expose. For more information, see [Docker security](https://docs.aws.amazon.com/https://docs.docker.com/engine/security/security/) .If you are setting namespaced kernel parameters using
systemControls
for the containers in the task, the following will apply to your IPC resource namespace. For more information, see [System Controls](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html) in the *Amazon Elastic Container Service Developer Guide* .- For tasks that use the
host
IPC mode, IPC namespace relatedsystemControls
are not supported. - For tasks that use thetask
IPC mode, IPC namespace relatedsystemControls
will apply to all containers within a task.> This parameter is not supported for Windows containers or tasks run on AWS Fargate .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-ipcmode
property memory
memory: string;
The amount (in MiB) of memory used by the task.
If your tasks runs on Amazon EC2 instances, you must specify either a task-level memory value or a container-level memory value. This field is optional and any value can be used. If a task-level memory value is specified, the container-level memory value is optional. For more information regarding container-level memory and memory reservation, see [ContainerDefinition](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ContainerDefinition.html) .
If your tasks runs on AWS Fargate , this field is required. You must use one of the following values. The value you choose determines your range of valid values for the
cpu
parameter.- 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available
cpu
values: 256 (.25 vCPU) - 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Availablecpu
values: 512 (.5 vCPU) - 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Availablecpu
values: 1024 (1 vCPU) - Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Availablecpu
values: 2048 (2 vCPU) - Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Availablecpu
values: 4096 (4 vCPU) - Between 16 GB and 60 GB in 4 GB increments - Availablecpu
values: 8192 (8 vCPU)This option requires Linux platform
1.4.0
or later. - Between 32GB and 120 GB in 8 GB increments - Availablecpu
values: 16384 (16 vCPU)This option requires Linux platform
1.4.0
or later.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-memory
property networkMode
networkMode: string;
The Docker networking mode to use for the containers in the task. The valid values are
none
,bridge
,awsvpc
, andhost
. If no network mode is specified, the default isbridge
.For Amazon ECS tasks on Fargate, the
awsvpc
network mode is required. For Amazon ECS tasks on Amazon EC2 Linux instances, any network mode can be used. For Amazon ECS tasks on Amazon EC2 Windows instances,<default>
orawsvpc
can be used. If the network mode is set tonone
, you cannot specify port mappings in your container definitions, and the tasks containers do not have external connectivity. Thehost
andawsvpc
network modes offer the highest networking performance for containers because they use the EC2 network stack instead of the virtualized network stack provided by thebridge
mode.With the
host
andawsvpc
network modes, exposed container ports are mapped directly to the corresponding host port (for thehost
network mode) or the attached elastic network interface port (for theawsvpc
network mode), so you cannot take advantage of dynamic host port mappings.> When using the
host
network mode, you should not run containers using the root user (UID 0). It is considered best practice to use a non-root user.If the network mode is
awsvpc
, the task is allocated an elastic network interface, and you must specify aNetworkConfiguration
value when you create a service or run a task with the task definition. For more information, see [Task Networking](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html) in the *Amazon Elastic Container Service Developer Guide* .If the network mode is
host
, you cannot run multiple instantiations of the same task on a single container instance when port mappings are used.For more information, see [Network settings](https://docs.aws.amazon.com/https://docs.docker.com/engine/reference/run/#network-settings) in the *Docker run reference* .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-networkmode
property pidMode
pidMode: string;
The process namespace to use for the containers in the task. The valid values are
host
ortask
. Ifhost
is specified, then all containers within the tasks that specified thehost
PID mode on the same container instance share the same process namespace with the host Amazon EC2 instance. Iftask
is specified, all containers within the specified task share the same process namespace. If no value is specified, the default is a private namespace. For more information, see [PID settings](https://docs.aws.amazon.com/https://docs.docker.com/engine/reference/run/#pid-settings---pid) in the *Docker run reference* .If the
host
PID mode is used, be aware that there is a heightened risk of undesired process namespace expose. For more information, see [Docker security](https://docs.aws.amazon.com/https://docs.docker.com/engine/security/security/) .> This parameter is not supported for Windows containers or tasks run on AWS Fargate .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-pidmode
property placementConstraints
placementConstraints: any;
An array of placement constraint objects to use for tasks.
> This parameter isn't supported for tasks run on AWS Fargate .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-placementconstraints
property proxyConfiguration
proxyConfiguration: any;
The configuration details for the App Mesh proxy.
Your Amazon ECS container instances require at least version 1.26.0 of the container agent and at least version 1.26.0-1 of the
ecs-init
package to use a proxy configuration. If your container instances are launched from the Amazon ECS optimized AMI version20190301
or later, they contain the required versions of the container agent andecs-init
. For more information, see [Amazon ECS-optimized Linux AMI](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html) in the *Amazon Elastic Container Service Developer Guide* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-proxyconfiguration
property requiresCompatibilities
requiresCompatibilities: string[];
The task launch types the task definition was validated against. For more information, see [Amazon ECS launch types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) in the *Amazon Elastic Container Service Developer Guide* .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-requirescompatibilities
property runtimePlatform
runtimePlatform: any;
The operating system that your tasks definitions run on. A platform family is specified only for tasks using the Fargate launch type.
When you specify a task definition in a service, this value must match the
runtimePlatform
value of the service.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-runtimeplatform
property tags
readonly tags: cdk.TagManager;
The metadata that you apply to the task definition to help you categorize and organize them. Each tag consists of a key and an optional value. You define both of them.
The following basic restrictions apply to tags:
- Maximum number of tags per resource - 50 - For each resource, each tag key must be unique, and each tag key can have only one value. - Maximum key length - 128 Unicode characters in UTF-8 - Maximum value length - 256 Unicode characters in UTF-8 - If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @. - Tag keys and values are case-sensitive. - Do not use
aws:
,AWS:
, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for AWS use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-tags
property taskRoleArn
taskRoleArn: string;
The short name or full Amazon Resource Name (ARN) of the AWS Identity and Access Management role that grants containers in the task permission to call AWS APIs on your behalf. For more information, see [Amazon ECS Task Role](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html) in the *Amazon Elastic Container Service Developer Guide* .
IAM roles for tasks on Windows require that the
-EnableTaskIAMRole
option is set when you launch the Amazon ECS-optimized Windows AMI. Your containers must also run some configuration code to use the feature. For more information, see [Windows IAM roles for tasks](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/windows_task_IAM_roles.html) in the *Amazon Elastic Container Service Developer Guide* .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-taskrolearn
property volumes
volumes: any;
The list of data volume definitions for the task. For more information, see [Using data volumes in tasks](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_data_volumes.html) in the *Amazon Elastic Container Service Developer Guide* .
> The
host
andsourcePath
parameters aren't supported for tasks run on AWS Fargate .http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html#cfn-ecs-taskdefinition-volumes
method inspect
inspect: (inspector: cdk.TreeInspector) => void;
Examines the CloudFormation resource and discloses attributes.
Parameter inspector
tree inspector to collect and process attributes
method renderProperties
protected renderProperties: (props: { [key: string]: any }) => { [key: string]: any;};
class CfnTaskSet
class CfnTaskSet extends cdk.CfnResource implements cdk.IInspectable {}
A CloudFormation
AWS::ECS::TaskSet
Create a task set in the specified cluster and service. This is used when a service uses the
EXTERNAL
deployment controller type. For more information, see [Amazon ECS deployment types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-types.html) in the *Amazon Elastic Container Service Developer Guide* .AWS::ECS::TaskSet external
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskset.html
constructor
constructor(scope: cdk.Construct, id: string, props: CfnTaskSetProps);
Create a new
AWS::ECS::TaskSet
.Parameter scope
scope in which this resource is defined
Parameter id
scoped id of the resource
Parameter props
resource properties
property attrId
readonly attrId: string;
The ID of the task set. Id
property CFN_RESOURCE_TYPE_NAME
static readonly CFN_RESOURCE_TYPE_NAME: string;
The CloudFormation resource type name for this resource class.
property cfnProperties
readonly cfnProperties: { [key: string]: any };
property cluster
cluster: string;
The short name or full Amazon Resource Name (ARN) of the cluster that hosts the service to create the task set in.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskset.html#cfn-ecs-taskset-cluster
property externalId
externalId: string;
An optional non-unique tag that identifies this task set in external systems. If the task set is associated with a service discovery registry, the tasks in this task set will have the
ECS_TASK_SET_EXTERNAL_ID
AWS Cloud Map attribute set to the provided value.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskset.html#cfn-ecs-taskset-externalid
property launchType
launchType: string;
The launch type that new tasks in the task set uses. For more information, see [Amazon ECS launch types](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) in the *Amazon Elastic Container Service Developer Guide* .
If a
launchType
is specified, thecapacityProviderStrategy
parameter must be omitted.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskset.html#cfn-ecs-taskset-launchtype
property loadBalancers
loadBalancers: any;
A load balancer object representing the load balancer to use with the task set. The supported load balancer types are either an Application Load Balancer or a Network Load Balancer.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskset.html#cfn-ecs-taskset-loadbalancers
property networkConfiguration
networkConfiguration: any;
The network configuration for the task set.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskset.html#cfn-ecs-taskset-networkconfiguration
property platformVersion
platformVersion: string;
The platform version that the tasks in the task set uses. A platform version is specified only for tasks using the Fargate launch type. If one isn't specified, the
LATEST
platform version is used.http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskset.html#cfn-ecs-taskset-platformversion
property scale
scale: any;
A floating-point percentage of your desired number of tasks to place and keep running in the task set.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskset.html#cfn-ecs-taskset-scale
property service
service: string;
The short name or full Amazon Resource Name (ARN) of the service to create the task set in.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskset.html#cfn-ecs-taskset-service
property serviceRegistries
serviceRegistries: any;
The details of the service discovery registries to assign to this task set. For more information, see [Service discovery](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-discovery.html) .
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskset.html#cfn-ecs-taskset-serviceregistries
property taskDefinition
taskDefinition: string;
The task definition for the tasks in the task set to use.
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskset.html#cfn-ecs-taskset-taskdefinition
method inspect
inspect: (inspector: cdk.TreeInspector) => void;
Examines the CloudFormation resource and discloses attributes.
Parameter inspector
tree inspector to collect and process attributes
method renderProperties
protected renderProperties: (props: { [key: string]: any }) => { [key: string]: any;};
class Cluster
class Cluster extends Resource implements ICluster {}
A regional grouping of one or more container instances on which you can run tasks and services.
constructor
constructor(scope: Construct, id: string, props?: ClusterProps);
Constructs a new instance of the Cluster class.
property autoscalingGroup
readonly autoscalingGroup: any;
Getter for autoscaling group added to cluster
property clusterArn
readonly clusterArn: string;
The Amazon Resource Name (ARN) that identifies the cluster.
property clusterName
readonly clusterName: string;
The name of the cluster.
property connections
readonly connections: ec2.Connections;
Manage the allowed network connections for the cluster with Security Groups.
property defaultCloudMapNamespace
readonly defaultCloudMapNamespace: any;
Getter for namespace added to cluster
property executeCommandConfiguration
readonly executeCommandConfiguration: ExecuteCommandConfiguration;
Getter for execute command configuration associated with the cluster.
property hasEc2Capacity
readonly hasEc2Capacity: boolean;
Whether the cluster has EC2 capacity associated with it
property vpc
readonly vpc: ec2.IVpc;
The VPC associated with the cluster.
method addAsgCapacityProvider
addAsgCapacityProvider: ( provider: AsgCapacityProvider, options?: AddAutoScalingGroupCapacityOptions) => void;
This method adds an Auto Scaling Group Capacity Provider to a cluster.
Parameter provider
the capacity provider to add to this cluster.
method addAutoScalingGroup
addAutoScalingGroup: ( autoScalingGroup: autoscaling.AutoScalingGroup, options?: AddAutoScalingGroupCapacityOptions) => void;
This method adds compute capacity to a cluster using the specified AutoScalingGroup.
Parameter autoScalingGroup
the ASG to add to this cluster. [disable-awslint:ref-via-interface] is needed in order to install the ECS agent by updating the ASGs user data.
Deprecated
Use Cluster.addAsgCapacityProvider instead.
method addCapacity
addCapacity: ( id: string, options: AddCapacityOptions) => autoscaling.AutoScalingGroup;
It is highly recommended to use Cluster.addAsgCapacityProvider instead of this method.
This method adds compute capacity to a cluster by creating an AutoScalingGroup with the specified options.
Returns the AutoScalingGroup so you can add autoscaling settings to it.
method addCapacityProvider
addCapacityProvider: (provider: string) => void;
This method enables the Fargate or Fargate Spot capacity providers on the cluster.
Parameter provider
the capacity provider to add to this cluster.
See Also
addAsgCapacityProvider to add an Auto Scaling Group capacity provider to the cluster.
Deprecated
Use enableFargateCapacityProviders instead.
method addDefaultCloudMapNamespace
addDefaultCloudMapNamespace: ( options: CloudMapNamespaceOptions) => cloudmap.INamespace;
Add an AWS Cloud Map DNS namespace for this cluster. NOTE: HttpNamespaces are not supported, as ECS always requires a DNSConfig when registering an instance to a Cloud Map service.
method enableFargateCapacityProviders
enableFargateCapacityProviders: () => void;
Enable the Fargate capacity providers for this cluster.
method fromClusterArn
static fromClusterArn: ( scope: Construct, id: string, clusterArn: string) => ICluster;
Import an existing cluster to the stack from the cluster ARN. This does not provide access to the vpc, hasEc2Capacity, or connections - use the
fromClusterAttributes
method to access those properties.
method fromClusterAttributes
static fromClusterAttributes: ( scope: Construct, id: string, attrs: ClusterAttributes) => ICluster;
Import an existing cluster to the stack from its attributes.
method metric
metric: ( metricName: string, props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
This method returns the specifed CloudWatch metric for this cluster.
method metricCpuReservation
metricCpuReservation: (props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
This method returns the CloudWatch metric for this clusters CPU reservation.
average over 5 minutes
method metricCpuUtilization
metricCpuUtilization: (props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
This method returns the CloudWatch metric for this clusters CPU utilization.
average over 5 minutes
method metricMemoryReservation
metricMemoryReservation: (props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
This method returns the CloudWatch metric for this clusters memory reservation.
average over 5 minutes
method metricMemoryUtilization
metricMemoryUtilization: (props?: cloudwatch.MetricOptions) => cloudwatch.Metric;
This method returns the CloudWatch metric for this clusters memory utilization.
average over 5 minutes
class ContainerDefinition
class ContainerDefinition extends CoreConstruct {}
A container definition is used in a task definition to describe the containers that are launched as part of a task.
constructor
constructor(scope: Construct, id: string, props: ContainerDefinitionProps);
Constructs a new instance of the ContainerDefinition class.
property containerDependencies
readonly containerDependencies: ContainerDependency[];
An array dependencies defined for container startup and shutdown.
property containerName
readonly containerName: string;
The name of this container
property containerPort
readonly containerPort: number;
The port the container will listen on.
property environmentFiles
readonly environmentFiles?: EnvironmentFileConfig[];
The environment files for this container
property essential
readonly essential: boolean;
Specifies whether the container will be marked essential.
If the essential parameter of a container is marked as true, and that container fails or stops for any reason, all other containers that are part of the task are stopped. If the essential parameter of a container is marked as false, then its failure does not affect the rest of the containers in a task.
If this parameter is omitted, a container is assumed to be essential.
property imageName
readonly imageName: string;
The name of the image referenced by this container.
property ingressPort
readonly ingressPort: number;
The inbound rules associated with the security group the task or service will use.
This property is only used for tasks that use the awsvpc network mode.
property linuxParameters
readonly linuxParameters?: LinuxParameters;
The Linux-specific modifications that are applied to the container, such as Linux kernel capabilities.
property logDriverConfig
readonly logDriverConfig?: LogDriverConfig;
The log configuration specification for the container.
property memoryLimitSpecified
readonly memoryLimitSpecified: boolean;
Whether there was at least one memory limit specified in this definition
property mountPoints
readonly mountPoints: MountPoint[];
The mount points for data volumes in your container.
property portMappings
readonly portMappings: PortMapping[];
The list of port mappings for the container. Port mappings allow containers to access ports on the host container instance to send or receive traffic.
property referencesSecretJsonField
readonly referencesSecretJsonField?: boolean;
Whether this container definition references a specific JSON field of a secret stored in Secrets Manager.
property taskDefinition
readonly taskDefinition: TaskDefinition;
The name of the task definition that includes this container definition.
property ulimits
readonly ulimits: Ulimit[];
An array of ulimits to set in the container.
property volumesFrom
readonly volumesFrom: VolumeFrom[];
The data volumes to mount from another container in the same task definition.
method addContainerDependencies
addContainerDependencies: ( ...containerDependencies: ContainerDependency[]) => void;
This method adds one or more container dependencies to the container.
method addEnvironment
addEnvironment: (name: string, value: string) => void;
This method adds an environment variable to the container.
method addInferenceAcceleratorResource
addInferenceAcceleratorResource: ( ...inferenceAcceleratorResources: string[]) => void;
This method adds one or more resources to the container.
method addLink
addLink: (container: ContainerDefinition, alias?: string) => void;
This method adds a link which allows containers to communicate with each other without the need for port mappings.
This parameter is only supported if the task definition is using the bridge network mode. Warning: The --link flag is a legacy feature of Docker. It may eventually be removed.
method addMountPoints
addMountPoints: (...mountPoints: MountPoint[]) => void;
This method adds one or more mount points for data volumes to the container.
method addPortMappings
addPortMappings: (...portMappings: PortMapping[]) => void;
This method adds one or more port mappings to the container.
method addScratch
addScratch: (scratch: ScratchSpace) => void;
This method mounts temporary disk space to the container.
This adds the correct container mountPoint and task definition volume.
method addToExecutionPolicy
addToExecutionPolicy: (statement: iam.PolicyStatement) => void;
This method adds the specified statement to the IAM task execution policy in the task definition.
method addUlimits
addUlimits: (...ulimits: Ulimit[]) => void;
This method adds one or more ulimits to the container.
method addVolumesFrom
addVolumesFrom: (...volumesFrom: VolumeFrom[]) => void;
This method adds one or more volumes to the container.
method findPortMapping
findPortMapping: ( containerPort: number, protocol: Protocol) => PortMapping | undefined;
Returns the host port for the requested container port if it exists
method renderContainerDefinition
renderContainerDefinition: ( _taskDefinition?: TaskDefinition) => CfnTaskDefinition.ContainerDefinitionProperty;
Render this container definition to a CloudFormation object
Parameter _taskDefinition
[disable-awslint:ref-via-interface] (unused but kept to avoid breaking change)
class ContainerImage
abstract class ContainerImage {}
Constructs for types of container images
method bind
abstract bind: ( scope: CoreConstruct, containerDefinition: ContainerDefinition) => ContainerImageConfig;
Called when the image is used by a ContainerDefinition
method fromAsset
static fromAsset: (directory: string, props?: AssetImageProps) => AssetImage;
Reference an image that's constructed directly from sources on disk.
If you already have a
DockerImageAsset
instance, you can use theContainerImage.fromDockerImageAsset
method instead.Parameter directory
The directory containing the Dockerfile
method fromDockerImageAsset
static fromDockerImageAsset: (asset: DockerImageAsset) => ContainerImage;
Use an existing
DockerImageAsset
for this container image.Parameter asset
The
DockerImageAsset
to use for this container definition.
method fromEcrRepository
static fromEcrRepository: ( repository: ecr.IRepository, tag?: string) => EcrImage;
Reference an image in an ECR repository
method fromRegistry
static fromRegistry: ( name: string, props?: RepositoryImageProps) => RepositoryImage;
Reference an image on DockerHub or another online registry
method fromTarball
static fromTarball: (tarballFile: string) => ContainerImage;
Use an existing tarball for this container image.
Use this method if the container image has already been created by another process (e.g. jib) and you want to add it as a container image asset.
Parameter tarballFile
Absolute path to the tarball. You can use language-specific idioms (such as
__dirname
in Node.js) to create an absolute path based on the current script running directory.
class CpuArchitecture
class CpuArchitecture {}
The CpuArchitecture for Fargate Runtime Platform.
property ARM64
static readonly ARM64: CpuArchitecture;
ARM64
property X86_64
static readonly X86_64: CpuArchitecture;
X86_64
method of
static of: (cpuArchitecture: string) => CpuArchitecture;
Other cpu architecture.
Parameter cpuArchitecture
cpu architecture.
See Also
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-runtimeplatform.html#cfn-ecs-taskdefinition-runtimeplatform-cpuarchitecture for all available cpu architecture.
class Ec2Service
class Ec2Service extends BaseService implements IEc2Service {}
This creates a service using the EC2 launch type on an ECS cluster.
AWS::ECS::Service
constructor
constructor(scope: Construct, id: string, props: Ec2ServiceProps);
Constructs a new instance of the Ec2Service class.
method addPlacementConstraints
addPlacementConstraints: (...constraints: PlacementConstraint[]) => void;
Adds one or more placement constraints to use for tasks in the service. For more information, see [Amazon ECS Task Placement Constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html).
method addPlacementStrategies
addPlacementStrategies: (...strategies: PlacementStrategy[]) => void;
Adds one or more placement strategies to use for tasks in the service. For more information, see [Amazon ECS Task Placement Strategies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html).
method fromEc2ServiceArn
static fromEc2ServiceArn: ( scope: Construct, id: string, ec2ServiceArn: string) => IEc2Service;
Imports from the specified service ARN.
method fromEc2ServiceAttributes
static fromEc2ServiceAttributes: ( scope: Construct, id: string, attrs: Ec2ServiceAttributes) => IBaseService;
Imports from the specified service attributes.
method validate
protected validate: () => string[];
Validates this Ec2Service.
class Ec2TaskDefinition
class Ec2TaskDefinition extends TaskDefinition implements IEc2TaskDefinition {}
The details of a task definition run on an EC2 cluster.
AWS::ECS::TaskDefinition
constructor
constructor(scope: Construct, id: string, props?: Ec2TaskDefinitionProps);
Constructs a new instance of the Ec2TaskDefinition class.
method fromEc2TaskDefinitionArn
static fromEc2TaskDefinitionArn: ( scope: Construct, id: string, ec2TaskDefinitionArn: string) => IEc2TaskDefinition;
Imports a task definition from the specified task definition ARN.
method fromEc2TaskDefinitionAttributes
static fromEc2TaskDefinitionAttributes: ( scope: Construct, id: string, attrs: Ec2TaskDefinitionAttributes) => IEc2TaskDefinition;
Imports an existing Ec2 task definition from its attributes
class EcrImage
class EcrImage extends ContainerImage {}
An image from an Amazon ECR repository.
constructor
constructor(repository: ecr.IRepository, tagOrDigest: string);
Constructs a new instance of the EcrImage class.
property imageName
readonly imageName: string;
The image name. Images in Amazon ECR repositories can be specified by either using the full registry/repository:tag or registry/repository@digest.
For example, 012345678910.dkr.ecr..amazonaws.com/:latest or 012345678910.dkr.ecr..amazonaws.com/@sha256:94afd1f2e64d908bc90dbca0035a5b567EXAMPLE.
method bind
bind: ( _scope: CoreConstruct, containerDefinition: ContainerDefinition) => ContainerImageConfig;
class EcsOptimizedAmi
class EcsOptimizedAmi implements ec2.IMachineImage {}
Construct a Linux or Windows machine image from the latest ECS Optimized AMI published in SSM
Deprecated
see EcsOptimizedImage#amazonLinux, EcsOptimizedImage#amazonLinux and EcsOptimizedImage#windows
constructor
constructor(props?: EcsOptimizedAmiProps);
Constructs a new instance of the EcsOptimizedAmi class.
method getImage
getImage: (scope: CoreConstruct) => ec2.MachineImageConfig;
Return the correct image
class EcsOptimizedImage
class EcsOptimizedImage implements ec2.IMachineImage {}
Construct a Linux or Windows machine image from the latest ECS Optimized AMI published in SSM
method amazonLinux
static amazonLinux: (options?: EcsOptimizedImageOptions) => EcsOptimizedImage;
Construct an Amazon Linux AMI image from the latest ECS Optimized AMI published in SSM
method amazonLinux2
static amazonLinux2: ( hardwareType?: AmiHardwareType, options?: EcsOptimizedImageOptions) => EcsOptimizedImage;
Construct an Amazon Linux 2 image from the latest ECS Optimized AMI published in SSM
Parameter hardwareType
ECS-optimized AMI variant to use
method getImage
getImage: (scope: CoreConstruct) => ec2.MachineImageConfig;
Return the correct image
method windows
static windows: ( windowsVersion: WindowsOptimizedVersion, options?: EcsOptimizedImageOptions) => EcsOptimizedImage;
Construct a Windows image from the latest ECS Optimized AMI published in SSM
Parameter windowsVersion
Windows Version to use
class EnvironmentFile
abstract class EnvironmentFile {}
Constructs for types of environment files
method bind
abstract bind: (scope: Construct) => EnvironmentFileConfig;
Called when the container is initialized to allow this object to bind to the stack.
Parameter scope
The binding scope
method fromAsset
static fromAsset: (path: string, options?: AssetOptions) => AssetEnvironmentFile;
Loads the environment file from a local disk path.
Parameter path
Local disk path
Parameter options
method fromBucket
static fromBucket: ( bucket: IBucket, key: string, objectVersion?: string) => S3EnvironmentFile;
Loads the environment file from an S3 bucket.
Parameter bucket
The S3 bucket
Parameter key
The object key
Parameter objectVersion
Optional S3 object version
Returns
S3EnvironmentFile
associated with the specified S3 object.
class ExternalService
class ExternalService extends BaseService implements IExternalService {}
This creates a service using the External launch type on an ECS cluster.
AWS::ECS::Service
constructor
constructor(scope: Construct, id: string, props: ExternalServiceProps);
Constructs a new instance of the ExternalService class.
method associateCloudMapService
associateCloudMapService: (_options: AssociateCloudMapServiceOptions) => void;
Overriden method to throw error as
associateCloudMapService
is not supported for external service
method attachToApplicationTargetGroup
attachToApplicationTargetGroup: ( _targetGroup: elbv2.IApplicationTargetGroup) => elbv2.LoadBalancerTargetProps;
Overriden method to throw error as
attachToApplicationTargetGroup
is not supported for external service
method autoScaleTaskCount
autoScaleTaskCount: (_props: appscaling.EnableScalingProps) => ScalableTaskCount;
Overriden method to throw error as
autoScaleTaskCount
is not supported for external service
method configureAwsVpcNetworkingWithSecurityGroups
protected configureAwsVpcNetworkingWithSecurityGroups: ( _vpc: ec2.IVpc, _assignPublicIp?: boolean, _vpcSubnets?: ec2.SubnetSelection, _securityGroups?: ec2.ISecurityGroup[]) => void;
Overriden method to throw error as
configureAwsVpcNetworkingWithSecurityGroups
is not supported for external service
method enableCloudMap
enableCloudMap: (_options: CloudMapOptions) => cloudmap.Service;
Overriden method to throw error as
enableCloudMap
is not supported for external service
method fromExternalServiceArn
static fromExternalServiceArn: ( scope: Construct, id: string, externalServiceArn: string) => IExternalService;
Imports from the specified service ARN.
method fromExternalServiceAttributes
static fromExternalServiceAttributes: ( scope: Construct, id: string, attrs: ExternalServiceAttributes) => IBaseService;
Imports from the specified service attributes.
method loadBalancerTarget
loadBalancerTarget: ( _options: LoadBalancerTargetOptions) => IEcsLoadBalancerTarget;
Overriden method to throw error as
loadBalancerTarget
is not supported for external service
method registerLoadBalancerTargets
registerLoadBalancerTargets: (..._targets: EcsTarget[]) => void;
Overriden method to throw error as
registerLoadBalancerTargets
is not supported for external service
class ExternalTaskDefinition
class ExternalTaskDefinition extends TaskDefinition implements IExternalTaskDefinition {}
The details of a task definition run on an External cluster.
AWS::ECS::TaskDefinition
constructor
constructor(scope: Construct, id: string, props?: ExternalTaskDefinitionProps);
Constructs a new instance of the ExternalTaskDefinition class.
method addInferenceAccelerator
addInferenceAccelerator: (_inferenceAccelerator: InferenceAccelerator) => void;
Overriden method to throw error as interface accelerators are not supported for external tasks
method fromEc2TaskDefinitionArn
static fromEc2TaskDefinitionArn: ( scope: Construct, id: string, externalTaskDefinitionArn: string) => IExternalTaskDefinition;
Imports a task definition from the specified task definition ARN.
method fromExternalTaskDefinitionAttributes
static fromExternalTaskDefinitionAttributes: ( scope: Construct, id: string, attrs: ExternalTaskDefinitionAttributes) => IExternalTaskDefinition;
Imports an existing External task definition from its attributes
class FargateService
class FargateService extends BaseService implements IFargateService {}
This creates a service using the Fargate launch type on an ECS cluster.
AWS::ECS::Service
constructor
constructor(scope: Construct, id: string, props: FargateServiceProps);
Constructs a new instance of the FargateService class.
method fromFargateServiceArn
static fromFargateServiceArn: ( scope: Construct, id: string, fargateServiceArn: string) => IFargateService;
Imports from the specified service ARN.
method fromFargateServiceAttributes
static fromFargateServiceAttributes: ( scope: Construct, id: string, attrs: FargateServiceAttributes) => IBaseService;
Imports from the specified service attributes.
class FargateTaskDefinition
class FargateTaskDefinition extends TaskDefinition implements IFargateTaskDefinition {}
The details of a task definition run on a Fargate cluster.
AWS::ECS::TaskDefinition
constructor
constructor(scope: Construct, id: string, props?: FargateTaskDefinitionProps);
Constructs a new instance of the FargateTaskDefinition class.
property ephemeralStorageGiB
readonly ephemeralStorageGiB?: number;
The amount (in GiB) of ephemeral storage to be allocated to the task.
property networkMode
readonly networkMode: NetworkMode;
The Docker networking mode to use for the containers in the task. Fargate tasks require the awsvpc network mode.
method fromFargateTaskDefinitionArn
static fromFargateTaskDefinitionArn: ( scope: Construct, id: string, fargateTaskDefinitionArn: string) => IFargateTaskDefinition;
Imports a task definition from the specified task definition ARN.
method fromFargateTaskDefinitionAttributes
static fromFargateTaskDefinitionAttributes: ( scope: Construct, id: string, attrs: FargateTaskDefinitionAttributes) => IFargateTaskDefinition;
Import an existing Fargate task definition from its attributes
class FireLensLogDriver
class FireLensLogDriver extends LogDriver {}
FireLens enables you to use task definition parameters to route logs to an AWS service or AWS Partner Network (APN) destination for log storage and analytics
constructor
constructor(props: FireLensLogDriverProps);
Constructs a new instance of the FireLensLogDriver class.
Parameter props
the awsfirelens log driver configuration options.
method bind
bind: ( _scope: CoreConstruct, _containerDefinition: ContainerDefinition) => LogDriverConfig;
Called when the log driver is configured on a container
class FirelensLogRouter
class FirelensLogRouter extends ContainerDefinition {}
Firelens log router
constructor
constructor(scope: Construct, id: string, props: FirelensLogRouterProps);
Constructs a new instance of the FirelensLogRouter class.
property firelensConfig
readonly firelensConfig: FirelensConfig;
Firelens configuration
method renderContainerDefinition
renderContainerDefinition: ( _taskDefinition?: TaskDefinition) => CfnTaskDefinition.ContainerDefinitionProperty;
Render this container definition to a CloudFormation object
class FluentdLogDriver
class FluentdLogDriver extends LogDriver {}
A log driver that sends log information to journald Logs.
constructor
constructor(props?: FluentdLogDriverProps);
Constructs a new instance of the FluentdLogDriver class.
Parameter props
the fluentd log driver configuration options.
method bind
bind: ( _scope: CoreConstruct, _containerDefinition: ContainerDefinition) => LogDriverConfig;
Called when the log driver is configured on a container
class GelfLogDriver
class GelfLogDriver extends LogDriver {}
A log driver that sends log information to journald Logs.
constructor
constructor(props: GelfLogDriverProps);
Constructs a new instance of the GelfLogDriver class.
Parameter props
the gelf log driver configuration options.
method bind
bind: ( _scope: CoreConstruct, _containerDefinition: ContainerDefinition) => LogDriverConfig;
Called when the log driver is configured on a container
class GenericLogDriver
class GenericLogDriver extends LogDriver {}
A log driver that sends logs to the specified driver.
constructor
constructor(props: GenericLogDriverProps);
Constructs a new instance of the GenericLogDriver class.
Parameter props
the generic log driver configuration options.
method bind
bind: ( _scope: CoreConstruct, _containerDefinition: ContainerDefinition) => LogDriverConfig;
Called when the log driver is configured on a container.
class JournaldLogDriver
class JournaldLogDriver extends LogDriver {}
A log driver that sends log information to journald Logs.
constructor
constructor(props?: JournaldLogDriverProps);
Constructs a new instance of the JournaldLogDriver class.
Parameter props
the journald log driver configuration options.
method bind
bind: ( _scope: CoreConstruct, _containerDefinition: ContainerDefinition) => LogDriverConfig;
Called when the log driver is configured on a container
class JsonFileLogDriver
class JsonFileLogDriver extends LogDriver {}
A log driver that sends log information to json-file Logs.
constructor
constructor(props?: JsonFileLogDriverProps);
Constructs a new instance of the JsonFileLogDriver class.
Parameter props
the json-file log driver configuration options.
method bind
bind: ( _scope: CoreConstruct, _containerDefinition: ContainerDefinition) => LogDriverConfig;
Called when the log driver is configured on a container
class LinuxParameters
class LinuxParameters extends CoreConstruct {}
Linux-specific options that are applied to the container.
constructor
constructor(scope: Construct, id: string, props?: LinuxParametersProps);
Constructs a new instance of the LinuxParameters class.
method addCapabilities
addCapabilities: (...cap: Capability[]) => void;
Adds one or more Linux capabilities to the Docker configuration of a container.
Only works with EC2 launch type.
method addDevices
addDevices: (...device: Device[]) => void;
Adds one or more host devices to a container.
method addTmpfs
addTmpfs: (...tmpfs: Tmpfs[]) => void;
Specifies the container path, mount options, and size (in MiB) of the tmpfs mount for a container.
Only works with EC2 launch type.
method dropCapabilities
dropCapabilities: (...cap: Capability[]) => void;
Removes one or more Linux capabilities to the Docker configuration of a container.
Only works with EC2 launch type.
method renderLinuxParameters
renderLinuxParameters: () => CfnTaskDefinition.LinuxParametersProperty;
Renders the Linux parameters to a CloudFormation object.
class ListenerConfig
abstract class ListenerConfig {}
Base class for configuring listener when registering targets.
method addTargets
abstract addTargets: ( id: string, target: LoadBalancerTargetOptions, service: BaseService) => void;
Create and attach a target group to listener.
method applicationListener
static applicationListener: ( listener: elbv2.ApplicationListener, props?: elbv2.AddApplicationTargetsProps) => ListenerConfig;
Create a config for adding target group to ALB listener.
method networkListener
static networkListener: ( listener: elbv2.NetworkListener, props?: elbv2.AddNetworkTargetsProps) => ListenerConfig;
Create a config for adding target group to NLB listener.
class LogDriver
abstract class LogDriver {}
The base class for log drivers.
method awsLogs
static awsLogs: (props: AwsLogDriverProps) => LogDriver;
Creates a log driver configuration that sends log information to CloudWatch Logs.
method bind
abstract bind: ( scope: CoreConstruct, containerDefinition: ContainerDefinition) => LogDriverConfig;
Called when the log driver is configured on a container
class LogDrivers
class LogDrivers {}
The base class for log drivers.
method awsLogs
static awsLogs: (props: AwsLogDriverProps) => LogDriver;
Creates a log driver configuration that sends log information to CloudWatch Logs.
method firelens
static firelens: (props: FireLensLogDriverProps) => LogDriver;
Creates a log driver configuration that sends log information to firelens log router. For detail configurations, please refer to Amazon ECS FireLens Examples: https://github.com/aws-samples/amazon-ecs-firelens-examples
method fluentd
static fluentd: (props?: FluentdLogDriverProps) => LogDriver;
Creates a log driver configuration that sends log information to fluentd Logs.
method gelf
static gelf: (props: GelfLogDriverProps) => LogDriver;
Creates a log driver configuration that sends log information to gelf Logs.
method journald
static journald: (props?: JournaldLogDriverProps) => LogDriver;
Creates a log driver configuration that sends log information to journald Logs.
method jsonFile
static jsonFile: (props?: JsonFileLogDriverProps) => LogDriver;
Creates a log driver configuration that sends log information to json-file Logs.
method splunk
static splunk: (props: SplunkLogDriverProps) => LogDriver;
Creates a log driver configuration that sends log information to splunk Logs.
method syslog
static syslog: (props?: SyslogLogDriverProps) => LogDriver;
Creates a log driver configuration that sends log information to syslog Logs.
class OperatingSystemFamily
class OperatingSystemFamily {}
The operating system for Fargate Runtime Platform.
property LINUX
static readonly LINUX: OperatingSystemFamily;
LINUX
property WINDOWS_SERVER_2004_CORE
static readonly WINDOWS_SERVER_2004_CORE: OperatingSystemFamily;
WINDOWS_SERVER_2004_CORE
property WINDOWS_SERVER_2016_FULL
static readonly WINDOWS_SERVER_2016_FULL: OperatingSystemFamily;
WINDOWS_SERVER_2016_FULL
property WINDOWS_SERVER_2019_CORE
static readonly WINDOWS_SERVER_2019_CORE: OperatingSystemFamily;
WINDOWS_SERVER_2019_CORE
property WINDOWS_SERVER_2019_FULL
static readonly WINDOWS_SERVER_2019_FULL: OperatingSystemFamily;
WINDOWS_SERVER_2019_FULL
property WINDOWS_SERVER_2022_CORE
static readonly WINDOWS_SERVER_2022_CORE: OperatingSystemFamily;
WINDOWS_SERVER_2022_CORE
property WINDOWS_SERVER_2022_FULL
static readonly WINDOWS_SERVER_2022_FULL: OperatingSystemFamily;
WINDOWS_SERVER_2022_FULL
property WINDOWS_SERVER_20H2_CORE
static readonly WINDOWS_SERVER_20H2_CORE: OperatingSystemFamily;
WINDOWS_SERVER_20H2_CORE
method of
static of: (family: string) => OperatingSystemFamily;
Other operating system family.
Parameter family
operating system family.
See Also
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-runtimeplatform.html#cfn-ecs-taskdefinition-runtimeplatform-operatingsystemfamily for all available operating system family.
class PlacementConstraint
class PlacementConstraint {}
The placement constraints to use for tasks in the service. For more information, see [Amazon ECS Task Placement Constraints](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-constraints.html).
Tasks will only be placed on instances that match these rules.
method distinctInstances
static distinctInstances: () => PlacementConstraint;
Use distinctInstance to ensure that each task in a particular group is running on a different container instance.
method memberOf
static memberOf: (...expressions: string[]) => PlacementConstraint;
Use memberOf to restrict the selection to a group of valid candidates specified by a query expression.
Multiple expressions can be specified. For more information, see [Cluster Query Language](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query-language.html).
You can specify multiple expressions in one call. The tasks will only be placed on instances matching all expressions.
See Also
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query-language.html
method toJson
toJson: () => CfnService.PlacementConstraintProperty[];
Return the placement JSON
class PlacementStrategy
class PlacementStrategy {}
The placement strategies to use for tasks in the service. For more information, see [Amazon ECS Task Placement Strategies](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-placement-strategies.html).
Tasks will preferentially be placed on instances that match these rules.
method packedBy
static packedBy: (resource: BinPackResource) => PlacementStrategy;
Places tasks on the container instances with the least available capacity of the specified resource.
method packedByCpu
static packedByCpu: () => PlacementStrategy;
Places tasks on container instances with the least available amount of CPU capacity.
This minimizes the number of instances in use.
method packedByMemory
static packedByMemory: () => PlacementStrategy;
Places tasks on container instances with the least available amount of memory capacity.
This minimizes the number of instances in use.
method randomly
static randomly: () => PlacementStrategy;
Places tasks randomly.
method spreadAcross
static spreadAcross: (...fields: string[]) => PlacementStrategy;
Places tasks evenly based on the specified value.
You can use one of the built-in attributes found on
BuiltInAttributes
or supply your own custom instance attributes. If more than one attribute is supplied, spreading is done in order.attributes instanceId
method spreadAcrossInstances
static spreadAcrossInstances: () => PlacementStrategy;
Places tasks evenly across all container instances in the cluster.
method toJson
toJson: () => CfnService.PlacementStrategyProperty[];
Return the placement JSON
class ProxyConfiguration
abstract class ProxyConfiguration {}
The base class for proxy configurations.
method bind
abstract bind: ( _scope: CoreConstruct, _taskDefinition: TaskDefinition) => CfnTaskDefinition.ProxyConfigurationProperty;
Called when the proxy configuration is configured on a task definition.
class ProxyConfigurations
class ProxyConfigurations {}
The base class for proxy configurations.
method appMeshProxyConfiguration
static appMeshProxyConfiguration: ( props: AppMeshProxyConfigurationConfigProps) => ProxyConfiguration;
Constructs a new instance of the ProxyConfiguration class.
class RepositoryImage
class RepositoryImage extends ContainerImage {}
An image hosted in a public or private repository. For images hosted in Amazon ECR, see [EcrImage](https://docs.aws.amazon.com/AmazonECR/latest/userguide/images.html).
constructor
constructor(imageName: string, props?: RepositoryImageProps);
Constructs a new instance of the RepositoryImage class.
method bind
bind: ( scope: CoreConstruct, containerDefinition: ContainerDefinition) => ContainerImageConfig;
class S3EnvironmentFile
class S3EnvironmentFile extends EnvironmentFile {}
Environment file from S3.
constructor
constructor(bucket: IBucket, key: string, objectVersion?: string);
method bind
bind: (_scope: Construct) => EnvironmentFileConfig;
class ScalableTaskCount
class ScalableTaskCount extends appscaling.BaseScalableAttribute {}
The scalable attribute representing task count.
constructor
constructor(scope: Construct, id: string, props: ScalableTaskCountProps);
Constructs a new instance of the ScalableTaskCount class.
method scaleOnCpuUtilization
scaleOnCpuUtilization: (id: string, props: CpuUtilizationScalingProps) => void;
Scales in or out to achieve a target CPU utilization.
method scaleOnMemoryUtilization
scaleOnMemoryUtilization: ( id: string, props: MemoryUtilizationScalingProps) => void;
Scales in or out to achieve a target memory utilization.
method scaleOnMetric
scaleOnMetric: ( id: string, props: appscaling.BasicStepScalingPolicyProps) => void;
Scales in or out based on a specified metric value.
method scaleOnRequestCount
scaleOnRequestCount: (id: string, props: RequestCountScalingProps) => void;
Scales in or out to achieve a target Application Load Balancer request count per target.
method scaleOnSchedule
scaleOnSchedule: (id: string, props: appscaling.ScalingSchedule) => void;
Scales in or out based on a specified scheduled time.
method scaleToTrackCustomMetric
scaleToTrackCustomMetric: (id: string, props: TrackCustomMetricProps) => void;
Scales in or out to achieve a target on a custom metric.
class Secret
abstract class Secret {}
A secret environment variable.
property arn
abstract readonly arn: string;
The ARN of the secret
property hasField
abstract readonly hasField?: boolean;
Whether this secret uses a specific JSON field
method fromSecretsManager
static fromSecretsManager: ( secret: secretsmanager.ISecret, field?: string) => Secret;
Creates a environment variable value from a secret stored in AWS Secrets Manager.
Parameter secret
the secret stored in AWS Secrets Manager
Parameter field
the name of the field with the value that you want to set as the environment variable value. Only values in JSON format are supported. If you do not specify a JSON field, then the full content of the secret is used.
method fromSecretsManagerVersion
static fromSecretsManagerVersion: ( secret: secretsmanager.ISecret, versionInfo: SecretVersionInfo, field?: string) => Secret;
Creates a environment variable value from a secret stored in AWS Secrets Manager.
Parameter secret
the secret stored in AWS Secrets Manager
Parameter versionInfo
the version information to reference the secret
Parameter field
the name of the field with the value that you want to set as the environment variable value. Only values in JSON format are supported. If you do not specify a JSON field, then the full content of the secret is used.
method fromSsmParameter
static fromSsmParameter: (parameter: ssm.IParameter) => Secret;
Creates an environment variable value from a parameter stored in AWS Systems Manager Parameter Store.
method grantRead
abstract grantRead: (grantee: iam.IGrantable) => iam.Grant;
Grants reading the secret to a principal
class SplunkLogDriver
class SplunkLogDriver extends LogDriver {}
A log driver that sends log information to splunk Logs.
constructor
constructor(props: SplunkLogDriverProps);
Constructs a new instance of the SplunkLogDriver class.
Parameter props
the splunk log driver configuration options.
method bind
bind: ( _scope: CoreConstruct, _containerDefinition: ContainerDefinition) => LogDriverConfig;
Called when the log driver is configured on a container
class SyslogLogDriver
class SyslogLogDriver extends LogDriver {}
A log driver that sends log information to syslog Logs.
constructor
constructor(props?: SyslogLogDriverProps);
Constructs a new instance of the SyslogLogDriver class.
Parameter props
the syslog log driver configuration options.
method bind
bind: ( _scope: CoreConstruct, _containerDefinition: ContainerDefinition) => LogDriverConfig;
Called when the log driver is configured on a container
class TagParameterContainerImage
class TagParameterContainerImage extends ContainerImage {}
A special type of ContainerImage that uses an ECR repository for the image, but a CloudFormation Parameter for the tag of the image in that repository. This allows providing this tag through the Parameter at deploy time, for example in a CodePipeline that pushes a new tag of the image to the repository during a build step, and then provides that new tag through the CloudFormation Parameter in the deploy step.
See Also
#tagParameterName
constructor
constructor(repository: ecr.IRepository);
property tagParameterName
readonly tagParameterName: string;
Returns the name of the CloudFormation Parameter that represents the tag of the image in the ECR repository.
property tagParameterValue
readonly tagParameterValue: string;
Returns the value of the CloudFormation Parameter that represents the tag of the image in the ECR repository.
method bind
bind: ( scope: Construct, containerDefinition: ContainerDefinition) => ContainerImageConfig;
class TaskDefinition
class TaskDefinition extends TaskDefinitionBase {}
The base class for all task definitions.
constructor
constructor(scope: Construct, id: string, props: TaskDefinitionProps);
Constructs a new instance of the TaskDefinition class.
property compatibility
readonly compatibility: Compatibility;
The task launch type compatibility requirement.
property containers
protected readonly containers: ContainerDefinition[];
The container definitions.
property defaultContainer
defaultContainer?: ContainerDefinition;
Default container for this task
Load balancers will send traffic to this container. The first essential container that is added to this task will become the default container.
property ephemeralStorageGiB
readonly ephemeralStorageGiB?: number;
The amount (in GiB) of ephemeral storage to be allocated to the task.
Only supported in Fargate platform version 1.4.0 or later.
property executionRole
readonly executionRole: any;
property family
readonly family: string;
The name of a family that this task definition is registered to. A family groups multiple versions of a task definition.
property inferenceAccelerators
readonly inferenceAccelerators: InferenceAccelerator[];
Public getter method to access list of inference accelerators attached to the instance.
property networkMode
readonly networkMode: NetworkMode;
The networking mode to use for the containers in the task.
property referencesSecretJsonField
readonly referencesSecretJsonField: boolean;
Whether this task definition has at least a container that references a specific JSON field of a secret stored in Secrets Manager.
property taskDefinitionArn
readonly taskDefinitionArn: string;
The full Amazon Resource Name (ARN) of the task definition.
property taskRole
readonly taskRole: iam.IRole;
The name of the IAM role that grants containers in the task permission to call AWS APIs on your behalf.
method addContainer
addContainer: ( id: string, props: ContainerDefinitionOptions) => ContainerDefinition;
Adds a new container to the task definition.
method addExtension
addExtension: (extension: ITaskDefinitionExtension) => void;
Adds the specified extension to the task definition.
Extension can be used to apply a packaged modification to a task definition.
method addFirelensLogRouter
addFirelensLogRouter: ( id: string, props: FirelensLogRouterDefinitionOptions) => FirelensLogRouter;
Adds a firelens log router to the task definition.
method addInferenceAccelerator
addInferenceAccelerator: (inferenceAccelerator: InferenceAccelerator) => void;
Adds an inference accelerator to the task definition.
method addPlacementConstraint
addPlacementConstraint: (constraint: PlacementConstraint) => void;
Adds the specified placement constraint to the task definition.
method addToExecutionRolePolicy
addToExecutionRolePolicy: (statement: iam.PolicyStatement) => void;
Adds a policy statement to the task execution IAM role.
method addToTaskRolePolicy
addToTaskRolePolicy: (statement: iam.PolicyStatement) => void;
Adds a policy statement to the task IAM role.
method addVolume
addVolume: (volume: Volume) => void;
Adds a volume to the task definition.
method findContainer
findContainer: (containerName: string) => ContainerDefinition | undefined;
Returns the container that match the provided containerName.
method fromTaskDefinitionArn
static fromTaskDefinitionArn: ( scope: Construct, id: string, taskDefinitionArn: string) => ITaskDefinition;
Imports a task definition from the specified task definition ARN.
The task will have a compatibility of EC2+Fargate.
method fromTaskDefinitionAttributes
static fromTaskDefinitionAttributes: ( scope: Construct, id: string, attrs: TaskDefinitionAttributes) => ITaskDefinition;
Create a task definition from a task definition reference
method obtainExecutionRole
obtainExecutionRole: () => iam.IRole;
Creates the task execution IAM role if it doesn't already exist.
method validate
protected validate: () => string[];
Validates the task definition.
Interfaces
interface AddAutoScalingGroupCapacityOptions
interface AddAutoScalingGroupCapacityOptions {}
The properties for adding an AutoScalingGroup.
property canContainersAccessInstanceRole
readonly canContainersAccessInstanceRole?: boolean;
Specifies whether the containers can access the container instance role.
false
property machineImageType
readonly machineImageType?: MachineImageType;
What type of machine image this is
Depending on the setting, different UserData will automatically be added to the
AutoScalingGroup
to configure it properly for use with ECS.If you create an
AutoScalingGroup
yourself and are adding it viaaddAutoScalingGroup()
, you must specify this value. If you are adding anautoScalingGroup
viaaddCapacity
, this value will be determined from themachineImage
you pass.- Automatically determined from
machineImage
, if available, otherwiseMachineImageType.AMAZON_LINUX_2
.
property spotInstanceDraining
readonly spotInstanceDraining?: boolean;
Specify whether to enable Automated Draining for Spot Instances running Amazon ECS Services. For more information, see [Using Spot Instances](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-instance-spot.html).
false
property taskDrainTime
readonly taskDrainTime?: Duration;
The time period to wait before force terminating an instance that is draining.
This creates a Lambda function that is used by a lifecycle hook for the AutoScalingGroup that will delay instance termination until all ECS tasks have drained from the instance. Set to 0 to disable task draining.
Set to 0 to disable task draining.
Deprecated
The lifecycle draining hook is not configured if using the EC2 Capacity Provider. Enable managed termination protection instead. Duration.minutes(5)
property topicEncryptionKey
readonly topicEncryptionKey?: kms.IKey;
If AddAutoScalingGroupCapacityOptions.taskDrainTime is non-zero, then the ECS cluster creates an SNS Topic to as part of a system to drain instances of tasks when the instance is being shut down. If this property is provided, then this key will be used to encrypt the contents of that SNS Topic. See [SNS Data Encryption](https://docs.aws.amazon.com/sns/latest/dg/sns-data-encryption.html) for more information.
The SNS Topic will not be encrypted.
interface AddCapacityOptions
interface AddCapacityOptions extends AddAutoScalingGroupCapacityOptions, autoscaling.CommonAutoScalingGroupProps {}
The properties for adding instance capacity to an AutoScalingGroup.
property instanceType
readonly instanceType: ec2.InstanceType;
The EC2 instance type to use when launching instances into the AutoScalingGroup.
property machineImage
readonly machineImage?: ec2.IMachineImage;
The ECS-optimized AMI variant to use
The default is to use an ECS-optimized AMI of Amazon Linux 2 which is automatically updated to the latest version on every deployment. This will replace the instances in the AutoScalingGroup. Make sure you have not disabled task draining, to avoid downtime when the AMI updates.
To use an image that does not update on every deployment, pass:
const machineImage = ecs.EcsOptimizedImage.amazonLinux2(ecs.AmiHardwareType.STANDARD, {cachedInContext: true,});For more information, see [Amazon ECS-optimized AMIs](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-optimized_AMI.html).
You must define either
machineImage
ormachineImageType
, not both.- Automatically updated, ECS-optimized Amazon Linux 2
interface AppMeshProxyConfigurationConfigProps
interface AppMeshProxyConfigurationConfigProps {}
The configuration to use when setting an App Mesh proxy configuration.
property containerName
readonly containerName: string;
The name of the container that will serve as the App Mesh proxy.
property properties
readonly properties: AppMeshProxyConfigurationProps;
The set of network configuration parameters to provide the Container Network Interface (CNI) plugin.
interface AppMeshProxyConfigurationProps
interface AppMeshProxyConfigurationProps {}
Interface for setting the properties of proxy configuration.
property appPorts
readonly appPorts: number[];
The list of ports that the application uses. Network traffic to these ports is forwarded to the ProxyIngressPort and ProxyEgressPort.
property egressIgnoredIPs
readonly egressIgnoredIPs?: string[];
The egress traffic going to these specified IP addresses is ignored and not redirected to the ProxyEgressPort. It can