Class CfnServicePropsMixin

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.Mixin
software.amazon.awscdk.cfnpropertymixins.services.ecs.CfnServicePropsMixin
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable, software.constructs.IMixin

@Generated(value="jsii-pacmak/1.127.0 (build 2117ad5)", date="2026-03-11T13:19:58.902Z") @Stability(Stable) public class CfnServicePropsMixin extends Mixin implements software.constructs.IMixin
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 ServiceConnectConfiguration property is configured. This is because AWS CloudFormation creates the replacement service first, but each ServiceConnectService 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. > 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 for CapacityProviderStrategy parameter with the standard practice. For more information, see Amazon ECS adds support for updating capacity provider configuration for ECS services . Previously Amazon ECS ignored the CapacityProviderStrategy property 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 the CapacityProviderStrategy property 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 CapacityProviderStrategy had FARGATE_SPOT or FARGATE capacity providers, the launch type will be updated to FARGATE and 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 CapacityProviderStrategy property entirely from your CloudFormation template
  • Alternatively, use !Ref AWS ::NoValue for the CapacityProviderStrategy property 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 CapacityProviderStrategy prior to the aforementioned launch on June 12, and you are using the same template with CapacityProviderStrategy: [] , 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:
  • Field Details

    • CFN_PROPERTY_KEYS

      @Stability(Stable) protected static final List<String> 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 to AWS::ECS::Service.

      Parameters:
      props - L1 properties to apply. This parameter is required.
      options - Mixin options.
    • CfnServicePropsMixin

      @Stability(Stable) public CfnServicePropsMixin(@NotNull CfnServiceMixinProps props)
      Create a mixin to apply properties to AWS::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.

      Specified by:
      applyTo in interface software.constructs.IMixin
      Specified by:
      applyTo in class Mixin
      Parameters:
      construct - This parameter is required.
    • supports

      @Stability(Stable) @NotNull public Boolean supports(@NotNull software.constructs.IConstruct construct)
      Check if this mixin supports the given construct.

      Specified by:
      supports in interface software.constructs.IMixin
      Overrides:
      supports in class Mixin
      Parameters:
      construct - This parameter is required.
    • getProps

      @Stability(Stable) @NotNull protected CfnServiceMixinProps getProps()
    • getStrategy

      @Stability(Stable) @NotNull protected IMergeStrategy getStrategy()