Skip to content

fix(ecs): prevent unnecessary updates when setting availabilityZoneRe…#35077

Open
AkitoAndo wants to merge 5 commits intoaws:mainfrom
AkitoAndo:fix/ecs-availability-zone-rebalancing-default
Open

fix(ecs): prevent unnecessary updates when setting availabilityZoneRe…#35077
AkitoAndo wants to merge 5 commits intoaws:mainfrom
AkitoAndo:fix/ecs-availability-zone-rebalancing-default

Conversation

@AkitoAndo
Copy link
Copy Markdown

AvailabilityZoneRebalancing explicitly causing task replacement

Closes #35051.

Reason for this change

When availabilityZoneRebalancing is explicitly set to DISABLED (the default value),
CloudFormation includes the property in the template, causing unnecessary service
updates and task replacement.

Description of changes

Modified FargateService and Ec2Service to only include availabilityZoneRebalancing
in CloudFormation template when explicitly set to ENABLED. This prevents
CloudFormation changes when the default DISABLED value is explicitly set.

Added test cases to verify the fix works correctly.

Description of how you validated changes

Added unit tests for both FargateService and Ec2Service to verify that:

  • AvailabilityZoneRebalancing is absent when explicitly set to DISABLED
  • AvailabilityZoneRebalancing is present when explicitly set to ENABLED"

@aws-cdk-automation aws-cdk-automation requested a review from a team July 27, 2025 04:51
@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2 labels Jul 27, 2025
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@AkitoAndo AkitoAndo force-pushed the fix/ecs-availability-zone-rebalancing-default branch from 56c9401 to 03de97b Compare July 27, 2025 08:10
@aws-cdk-automation aws-cdk-automation dismissed their stale review July 27, 2025 08:12

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@AkitoAndo AkitoAndo force-pushed the fix/ecs-availability-zone-rebalancing-default branch 3 times, most recently from aada440 to 884c6a9 Compare July 27, 2025 11:43
@AkitoAndo AkitoAndo force-pushed the fix/ecs-availability-zone-rebalancing-default branch from 884c6a9 to 3377b14 Compare July 27, 2025 12:38
@AkitoAndo AkitoAndo force-pushed the fix/ecs-availability-zone-rebalancing-default branch from 41774d5 to 9af8ce6 Compare July 27, 2025 13:39
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 9af8ce6
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

CDK Contributor and others added 3 commits August 12, 2025 13:52
…DISABLED

Updated integration test snapshots to reflect the correct behavior where
AvailabilityZoneRebalancing property should be omitted from CloudFormation
template when set to DISABLED, preventing unnecessary service updates.
Updated the integration test snapshot to reflect the current test code which
specifies memoryLimitMiB: 512. This aligns the snapshot with the actual test
implementation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-ecs): setting AvailabilityZoneRebalancing explicitly causing task replacement

4 participants