Class CfnServicePropsMixin
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable,software.constructs.IMixin
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 template- Alternatively, use
!Ref AWS ::NoValuefor theCapacityProviderStrategyproperty in your template- If 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.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.cfnpropertymixins.services.ecs.*;
import software.amazon.awscdk.*;
Object hookDetails;
IMergeStrategy mergeStrategy;
CfnServicePropsMixin cfnServicePropsMixin = CfnServicePropsMixin.Builder.create(CfnServiceMixinProps.builder()
.availabilityZoneRebalancing("availabilityZoneRebalancing")
.capacityProviderStrategy(List.of(CapacityProviderStrategyItemProperty.builder()
.base(123)
.capacityProvider("capacityProvider")
.weight(123)
.build()))
.cluster("cluster")
.deploymentConfiguration(DeploymentConfigurationProperty.builder()
.alarms(DeploymentAlarmsProperty.builder()
.alarmNames(List.of("alarmNames"))
.enable(false)
.rollback(false)
.build())
.bakeTimeInMinutes(123)
.canaryConfiguration(CanaryConfigurationProperty.builder()
.canaryBakeTimeInMinutes(123)
.canaryPercent(123)
.build())
.deploymentCircuitBreaker(DeploymentCircuitBreakerProperty.builder()
.enable(false)
.rollback(false)
.build())
.lifecycleHooks(List.of(DeploymentLifecycleHookProperty.builder()
.hookDetails(hookDetails)
.hookTargetArn("hookTargetArn")
.lifecycleStages(List.of("lifecycleStages"))
.roleArn("roleArn")
.build()))
.linearConfiguration(LinearConfigurationProperty.builder()
.stepBakeTimeInMinutes(123)
.stepPercent(123)
.build())
.maximumPercent(123)
.minimumHealthyPercent(123)
.strategy("strategy")
.build())
.deploymentController(DeploymentControllerProperty.builder()
.type("type")
.build())
.desiredCount(123)
.enableEcsManagedTags(false)
.enableExecuteCommand(false)
.forceNewDeployment(ForceNewDeploymentProperty.builder()
.enableForceNewDeployment(false)
.forceNewDeploymentNonce("forceNewDeploymentNonce")
.build())
.healthCheckGracePeriodSeconds(123)
.launchType("launchType")
.loadBalancers(List.of(LoadBalancerProperty.builder()
.advancedConfiguration(AdvancedConfigurationProperty.builder()
.alternateTargetGroupArn("alternateTargetGroupArn")
.productionListenerRule("productionListenerRule")
.roleArn("roleArn")
.testListenerRule("testListenerRule")
.build())
.containerName("containerName")
.containerPort(123)
.loadBalancerName("loadBalancerName")
.targetGroupArn("targetGroupArn")
.build()))
.networkConfiguration(NetworkConfigurationProperty.builder()
.awsvpcConfiguration(AwsVpcConfigurationProperty.builder()
.assignPublicIp("assignPublicIp")
.securityGroups(List.of("securityGroups"))
.subnets(List.of("subnets"))
.build())
.build())
.placementConstraints(List.of(PlacementConstraintProperty.builder()
.expression("expression")
.type("type")
.build()))
.placementStrategies(List.of(PlacementStrategyProperty.builder()
.field("field")
.type("type")
.build()))
.platformVersion("platformVersion")
.propagateTags("propagateTags")
.role("role")
.schedulingStrategy("schedulingStrategy")
.serviceConnectConfiguration(ServiceConnectConfigurationProperty.builder()
.accessLogConfiguration(ServiceConnectAccessLogConfigurationProperty.builder()
.format("format")
.includeQueryParameters("includeQueryParameters")
.build())
.enabled(false)
.logConfiguration(LogConfigurationProperty.builder()
.logDriver("logDriver")
.options(Map.of(
"optionsKey", "options"))
.secretOptions(List.of(SecretProperty.builder()
.name("name")
.valueFrom("valueFrom")
.build()))
.build())
.namespace("namespace")
.services(List.of(ServiceConnectServiceProperty.builder()
.clientAliases(List.of(ServiceConnectClientAliasProperty.builder()
.dnsName("dnsName")
.port(123)
.testTrafficRules(ServiceConnectTestTrafficRulesProperty.builder()
.header(ServiceConnectTestTrafficRulesHeaderProperty.builder()
.name("name")
.value(ServiceConnectTestTrafficRulesHeaderValueProperty.builder()
.exact("exact")
.build())
.build())
.build())
.build()))
.discoveryName("discoveryName")
.ingressPortOverride(123)
.portName("portName")
.timeout(TimeoutConfigurationProperty.builder()
.idleTimeoutSeconds(123)
.perRequestTimeoutSeconds(123)
.build())
.tls(ServiceConnectTlsConfigurationProperty.builder()
.issuerCertificateAuthority(ServiceConnectTlsCertificateAuthorityProperty.builder()
.awsPcaAuthorityArn("awsPcaAuthorityArn")
.build())
.kmsKey("kmsKey")
.roleArn("roleArn")
.build())
.build()))
.build())
.serviceName("serviceName")
.serviceRegistries(List.of(ServiceRegistryProperty.builder()
.containerName("containerName")
.containerPort(123)
.port(123)
.registryArn("registryArn")
.build()))
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.taskDefinition("taskDefinition")
.volumeConfigurations(List.of(ServiceVolumeConfigurationProperty.builder()
.managedEbsVolume(ServiceManagedEBSVolumeConfigurationProperty.builder()
.encrypted(false)
.filesystemType("filesystemType")
.iops(123)
.kmsKeyId("kmsKeyId")
.roleArn("roleArn")
.sizeInGiB(123)
.snapshotId("snapshotId")
.tagSpecifications(List.of(EBSTagSpecificationProperty.builder()
.propagateTags("propagateTags")
.resourceType("resourceType")
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.build()))
.throughput(123)
.volumeInitializationRate(123)
.volumeType("volumeType")
.build())
.name("name")
.build()))
.vpcLatticeConfigurations(List.of(VpcLatticeConfigurationProperty.builder()
.portName("portName")
.roleArn("roleArn")
.targetGroupArn("targetGroupArn")
.build()))
.build())
.strategy(mergeStrategy)
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe advanced settings for a load balancer used in blue/green deployments.static interfaceAn object representing the networking details for a task or service.static final classA fluent builder forCfnServicePropsMixin.static interfaceConfiguration for a canary deployment strategy that shifts a fixed percentage of traffic to the new service revision, waits for a specified bake time, then shifts the remaining traffic.static interfaceThe details of a capacity provider strategy.static interfaceOne of the methods which provide a way for you to quickly identify when a deployment has failed, and then to optionally roll back the failure to the last working deployment.static interfacestatic interfaceOptional deployment parameters that control how many tasks run during a deployment and the ordering of stopping and starting tasks.static interfaceThe deployment controller to use for the service.static interfaceA deployment lifecycle hook runs custom logic at specific stages of the deployment process.static interfaceThe tag specifications of an Amazon EBS volume.static interfaceDetermines whether to force a new deployment of the service.static interfaceConfiguration for a linear deployment strategy that shifts production traffic in equal percentage increments with configurable wait times between each step until 100 percent of traffic is shifted to the new service revision.static interfaceTheLoadBalancerproperty specifies details on a load balancer that is used with a service.static interfaceThe log configuration for the container.static interfaceThe network configuration for a task or service.static interfaceAn object representing a constraint on task placement.static interfaceThe task placement strategy for a task or service.static interfaceAn object representing the secret to expose to your container.static interfaceConfiguration for Service Connect access logging.static interfaceEach alias ("endpoint") is a fully-qualified name and port number that other tasks ("clients") can use to connect to this service.static interfaceThe Service Connect configuration of your Amazon ECS service.static interfaceThe Service Connect service object configuration.static interfaceExample:static interfaceExample:static interfaceThe test traffic routing configuration for Amazon ECS blue/green deployments.static interfaceThe certificate root authority that secures your service.static interfaceThe key that encrypts and decrypts your resources for Service Connect TLS.static interfaceThe configuration for the Amazon EBS volume that Amazon ECS creates and manages on your behalf.static interfaceThe details for the service registry.static interfaceThe configuration for a volume specified in the task definition as a volume that is configured at launch time.static interfaceAn object that represents the timeout configurations for Service Connect.static interfaceThe VPC Lattice configuration for your service that holds the information for the target group(s) Amazon ECS tasks will be registered to.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IMixin
software.constructs.IMixin.Jsii$Default, software.constructs.IMixin.Jsii$Proxy -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionCreate a mixin to apply properties toAWS::ECS::Service.CfnServicePropsMixin(CfnServiceMixinProps props, CfnPropertyMixinOptions options) Create a mixin to apply properties toAWS::ECS::Service.protectedCfnServicePropsMixin(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnServicePropsMixin(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyTo(software.constructs.IConstruct construct) Apply the mixin properties to the construct.protected CfnServiceMixinPropsgetProps()protected IMergeStrategysupports(software.constructs.IConstruct construct) Check if this mixin supports the given construct.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_PROPERTY_KEYS
-
-
Constructor Details
-
CfnServicePropsMixin
protected CfnServicePropsMixin(software.amazon.jsii.JsiiObjectRef objRef) -
CfnServicePropsMixin
protected CfnServicePropsMixin(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnServicePropsMixin
@Stability(Stable) public CfnServicePropsMixin(@NotNull CfnServiceMixinProps props, @Nullable CfnPropertyMixinOptions options) Create a mixin to apply properties toAWS::ECS::Service.- Parameters:
props- L1 properties to apply. This parameter is required.options- Mixin options.
-
CfnServicePropsMixin
Create a mixin to apply properties toAWS::ECS::Service.- Parameters:
props- L1 properties to apply. This parameter is required.
-
-
Method Details
-
applyTo
@Stability(Stable) public void applyTo(@NotNull software.constructs.IConstruct construct) Apply the mixin properties to the construct. -
supports
@Stability(Stable) @NotNull public Boolean supports(@NotNull software.constructs.IConstruct construct) Check if this mixin supports the given construct. -
getProps
-
getStrategy
-