This repository was archived by the owner on Jan 25, 2026. It is now read-only.
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances AWS ECS service resilience for Spot instance workloads by improving resource allocation, scaling efficiency, and connection draining. The changes adjust capacity provider strategies, task placement rules, memory management, and ALB deregistration timing to better handle infrastructure disruptions.
Key Changes:
- Added capacity provider strategy with base allocation and distinctInstance placement constraints for better fault tolerance
- Optimized ECS managed scaling target from 100% to 90% capacity and introduced memory reservation alongside hard memory limits
- Increased ALB target group deregistration delay from 5 to 30 seconds for graceful connection draining
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| Modules/AWS/ECS/main.tf | Adds capacity provider strategy with base=2 and distinctInstance constraint; introduces memoryReservation=512 alongside memory=768; reduces managed scaling target_capacity to 90% |
| Modules/AWS/ALB/main.tf | Increases deregistration_delay from 5 to 30 seconds for better handling of in-flight requests during instance termination |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements to the AWS ECS and ALB infrastructure modules. The main changes focus on optimizing ECS resource allocation, enhancing scaling strategies, and adjusting ALB target group settings for better performance and reliability.
ECS Service & Capacity Provider Enhancements:
capacity_provider_strategyblock to the ECS service, specifying the use of the defined capacity provider with a base of 2 and weight of 1 to better control resource allocation.placement_constraintsblock to ensure containers are placed on distinct instances, improving fault tolerance.ECS Task Definition Improvements:
memoryReservation(512) alongsidememory(768) for better resource management within the container.ALB Target Group Configuration:
deregistration_delayfor the ALB target group from 5 seconds to 30 seconds to allow more time for in-flight requests to complete during instance deregistration.