class CfnServicePropsMixin
| Language | Type name |
|---|---|
.NET | Amazon.CDK.Mixins.Preview.AWS.ECS.Mixins.CfnServicePropsMixin |
Go | github.com/aws/aws-cdk-go/awscdkmixinspreview/v2/awsecs/mixins#CfnServicePropsMixin |
Java | software.amazon.awscdk.mixins.preview.services.ecs.mixins.CfnServicePropsMixin |
Python | aws_cdk.mixins_preview.aws_ecs.mixins.CfnServicePropsMixin |
TypeScript | @aws-cdk/mixins-preview » aws_ecs » mixins » CfnServicePropsMixin |
Implements
IMixin
Extends
Mixin
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
ServiceConnectConfigurationproperty is configured. This is because AWS CloudFormation creates the replacement service first, but eachServiceConnectServicemust 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. > On June 12, 2025, Amazon ECS launched support for updating capacity provider configuration for Amazon ECS services. With this launch, Amazon ECS also aligned the CloudFormation update behavior forCapacityProviderStrategyparameter with the standard practice. For more information, see Amazon ECS adds support for updating capacity provider configuration for ECS services . Previously Amazon ECS ignored theCapacityProviderStrategyproperty if it was set to an empty list for example,[]in CloudFormation , because updating capacity provider configuration was not supported. Now, with support for capacity provider updates, customers can remove capacity providers from a service by passing an empty list. When you specify an empty list ([]) for theCapacityProviderStrategyproperty in your CloudFormation template, Amazon ECS will remove any capacity providers associated with the service, as follows:
For services created with a capacity provider strategy after the launch:
If there's a cluster default strategy set, the service will revert to using that default strategy.
If no cluster default strategy exists, you will receive the following error:
No launch type to fall back to for empty capacity provider strategy. Your service was not created with a launch type.
For services created with a capacity provider strategy prior to the launch:
If
CapacityProviderStrategyhadFARGATE_SPOTorFARGATEcapacity providers, the launch type will be updated toFARGATEand the capacity provider will be removed.If the strategy included Auto Scaling group capacity providers, the service will revert to EC2 launch type, and the Auto Scaling group capacity providers will not be used.
Recommended Actions
If you are currently using
CapacityProviderStrategy: []in your CloudFormation templates, you should take one of the following actions:
If you do not intend to update the Capacity Provider Strategy:
Remove the
CapacityProviderStrategyproperty entirely from your CloudFormation templateAlternatively, use
!Ref AWS ::NoValuefor theCapacityProviderStrategyproperty in your templateIf you intend to maintain or update the Capacity Provider Strategy, specify the actual Capacity Provider Strategy for the service in your CloudFormation template.
If your CloudFormation template had an empty list ([]) for
CapacityProviderStrategyprior to the aforementioned launch on June 12, and you are using the same template withCapacityProviderStrategy: [], you might encounter the following error:Invalid request provided: When switching from launch type to capacity provider strategy on an existing service, or making a change to a capacity provider strategy on a service that is already using one, you must force a new deployment. (Service: Ecs, Status Code: 400, Request ID: xxx) (SDK Attempt Count: 1)" (RequestToken: xxx HandlerErrorCode: InvalidRequest)
Note that CloudFormation automatically initiates a new deployment when it detects a parameter change, but customers cannot choose to force a deployment through CloudFormation . This is an invalid input scenario that requires one of the remediation actions listed above.
If you are experiencing active production issues related to this change, contact AWS Support or your Technical Account Manager.
See also: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-service.html
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { mixins } from '@aws-cdk/mixins-preview';
import { mixins as ecs_mixins } from '@aws-cdk/mixins-preview/aws-ecs';
declare const hookDetails: any;
const cfnServicePropsMixin = new ecs_mixins.CfnServicePropsMixin({
availabilityZoneRebalancing: 'availabilityZoneRebalancing',
capacityProviderStrategy: [{
base: 123,
capacityProvider: 'capacityProvider',
weight: 123,
}],
cluster: 'cluster',
deploymentConfiguration: {
alarms: {
alarmNames: ['alarmNames'],
enable: false,
rollback: false,
},
bakeTimeInMinutes: 123,
canaryConfiguration: {
canaryBakeTimeInMinutes: 123,
canaryPercent: 123,
},
deploymentCircuitBreaker: {
enable: false,
rollback: false,
},
lifecycleHooks: [{
hookDetails: hookDetails,
hookTargetArn: 'hookTargetArn',
lifecycleStages: ['lifecycleStages'],
roleArn: 'roleArn',
}],
linearConfiguration: {
stepBakeTimeInMinutes: 123,
stepPercent: 123,
},
maximumPercent: 123,
minimumHealthyPercent: 123,
strategy: 'strategy',
},
deploymentController: {
type: 'type',
},
desiredCount: 123,
enableEcsManagedTags: false,
enableExecuteCommand: false,
forceNewDeployment: {
enableForceNewDeployment: false,
forceNewDeploymentNonce: 'forceNewDeploymentNonce',
},
healthCheckGracePeriodSeconds: 123,
launchType: 'launchType',
loadBalancers: [{
advancedConfiguration: {
alternateTargetGroupArn: 'alternateTargetGroupArn',
productionListenerRule: 'productionListenerRule',
roleArn: 'roleArn',
testListenerRule: 'testListenerRule',
},
containerName: 'containerName',
containerPort: 123,
loadBalancerName: 'loadBalancerName',
targetGroupArn: 'targetGroupArn',
}],
networkConfiguration: {
awsvpcConfiguration: {
assignPublicIp: 'assignPublicIp',
securityGroups: ['securityGroups'],
subnets: ['subnets'],
},
},
placementConstraints: [{
expression: 'expression',
type: 'type',
}],
placementStrategies: [{
field: 'field',
type: 'type',
}],
platformVersion: 'platformVersion',
propagateTags: 'propagateTags',
role: 'role',
schedulingStrategy: 'schedulingStrategy',
serviceConnectConfiguration: {
accessLogConfiguration: {
format: 'format',
includeQueryParameters: 'includeQueryParameters',
},
enabled: false,
logConfiguration: {
logDriver: 'logDriver',
options: {
optionsKey: 'options',
},
secretOptions: [{
name: 'name',
valueFrom: 'valueFrom',
}],
},
namespace: 'namespace',
services: [{
clientAliases: [{
dnsName: 'dnsName',
port: 123,
testTrafficRules: {
header: {
name: 'name',
value: {
exact: 'exact',
},
},
},
}],
discoveryName: 'discoveryName',
ingressPortOverride: 123,
portName: 'portName',
timeout: {
idleTimeoutSeconds: 123,
perRequestTimeoutSeconds: 123,
},
tls: {
issuerCertificateAuthority: {
awsPcaAuthorityArn: 'awsPcaAuthorityArn',
},
kmsKey: 'kmsKey',
roleArn: 'roleArn',
},
}],
},
serviceName: 'serviceName',
serviceRegistries: [{
containerName: 'containerName',
containerPort: 123,
port: 123,
registryArn: 'registryArn',
}],
tags: [{
key: 'key',
value: 'value',
}],
taskDefinition: 'taskDefinition',
volumeConfigurations: [{
managedEbsVolume: {
encrypted: false,
filesystemType: 'filesystemType',
iops: 123,
kmsKeyId: 'kmsKeyId',
roleArn: 'roleArn',
sizeInGiB: 123,
snapshotId: 'snapshotId',
tagSpecifications: [{
propagateTags: 'propagateTags',
resourceType: 'resourceType',
tags: [{
key: 'key',
value: 'value',
}],
}],
throughput: 123,
volumeInitializationRate: 123,
volumeType: 'volumeType',
},
name: 'name',
}],
vpcLatticeConfigurations: [{
portName: 'portName',
roleArn: 'roleArn',
targetGroupArn: 'targetGroupArn',
}],
}, /* all optional props */ {
strategy: mixins.PropertyMergeStrategy.OVERRIDE,
});
Initializer
new CfnServicePropsMixin(props: CfnServiceMixinProps, options?: CfnPropertyMixinOptions)
Parameters
- props
Cfn— L1 properties to apply.Service Mixin Props - options
Cfn— Mixin options.Property Mixin Options
Create a mixin to apply properties to AWS::ECS::Service.
Properties
| Name | Type | Description |
|---|---|---|
| props | Cfn | |
| strategy | Property | |
| static CFN_PROPERTY_KEYS | string[] |
props
Type:
Cfn
strategy
Type:
Property
static CFN_PROPERTY_KEYS
Type:
string[]
Methods
| Name | Description |
|---|---|
| apply | Apply the mixin properties to the construct. |
| supports(construct) | Check if this mixin supports the given construct. |
applyTo(construct)
public applyTo(construct: IConstruct): IConstruct
Parameters
- construct
IConstruct
Returns
Apply the mixin properties to the construct.
supports(construct)
public supports(construct: IConstruct): boolean
Parameters
- construct
IConstruct
Returns
boolean
Check if this mixin supports the given construct.

.NET
Go
Java
Python
TypeScript