Repository navigation
Shrink ECS cluster to one t3a.medium - #263
Merged
Merged
Conversation
Contributor
|
Terraform plan in terraform Plan: 0 to add, 11 to change, 0 to destroy.Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
!~ update in-place
Terraform will perform the following actions:
# module.platform.aws_launch_template.ecs will be updated in-place
!~ resource "aws_launch_template" "ecs" {
id = "lt-0093b22d4b048e101"
!~ instance_type = "m5.large" -> "t3a.medium"
!~ latest_version = 9 -> (known after apply)
name = "ecs-incubator-prod"
tags = {}
# (17 unchanged attributes hidden)
# (2 unchanged blocks hidden)
}
# module.civic-tech-index.module.backend_prod_service.aws_ecs_service.fargate[0] will be updated in-place
!~ resource "aws_ecs_service" "fargate" {
id = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/civic-tech-index-backend-prod"
name = "civic-tech-index-backend-prod"
tags = {
"project" = "civic-tech-index"
}
# (19 unchanged attributes hidden)
!~ ordered_placement_strategy {
!~ field = "attribute:ecs.availability-zone" -> "memory"
!~ type = "spread" -> "binpack"
}
- ordered_placement_strategy {
- field = "instanceId" -> null
- type = "spread" -> null
}
# (4 unchanged blocks hidden)
}
# module.civic-tech-index.module.backend_stage_service.aws_ecs_service.fargate[0] will be updated in-place
!~ resource "aws_ecs_service" "fargate" {
id = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/civic-tech-index-backend-stage"
name = "civic-tech-index-backend-stage"
tags = {
"project" = "civic-tech-index"
}
# (19 unchanged attributes hidden)
!~ ordered_placement_strategy {
!~ field = "attribute:ecs.availability-zone" -> "memory"
!~ type = "spread" -> "binpack"
}
- ordered_placement_strategy {
- field = "instanceId" -> null
- type = "spread" -> null
}
# (4 unchanged blocks hidden)
}
# module.civic-tech-jobs.module.civic_tech_jobs_fullstack_stage_service.aws_ecs_service.fargate[0] will be updated in-place
!~ resource "aws_ecs_service" "fargate" {
id = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/civic-tech-jobs-fullstack-stage"
name = "civic-tech-jobs-fullstack-stage"
tags = {
"project" = "civic-tech-jobs"
}
# (19 unchanged attributes hidden)
!~ ordered_placement_strategy {
!~ field = "attribute:ecs.availability-zone" -> "memory"
!~ type = "spread" -> "binpack"
}
- ordered_placement_strategy {
- field = "instanceId" -> null
- type = "spread" -> null
}
# (4 unchanged blocks hidden)
}
# module.home-unite-us.module.prod_service.aws_ecs_service.fargate[0] will be updated in-place
!~ resource "aws_ecs_service" "fargate" {
id = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/home-unite-us-fullstack-prod"
name = "home-unite-us-fullstack-prod"
tags = {
"project" = "home-unite-us"
}
# (19 unchanged attributes hidden)
!~ ordered_placement_strategy {
!~ field = "attribute:ecs.availability-zone" -> "memory"
!~ type = "spread" -> "binpack"
}
- ordered_placement_strategy {
- field = "instanceId" -> null
- type = "spread" -> null
}
# (4 unchanged blocks hidden)
}
# module.home-unite-us.module.qa_service.aws_ecs_service.fargate[0] will be updated in-place
!~ resource "aws_ecs_service" "fargate" {
id = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/home-unite-us-fullstack-qa"
name = "home-unite-us-fullstack-qa"
tags = {
"project" = "home-unite-us"
}
# (19 unchanged attributes hidden)
!~ ordered_placement_strategy {
!~ field = "attribute:ecs.availability-zone" -> "memory"
!~ type = "spread" -> "binpack"
}
- ordered_placement_strategy {
- field = "instanceId" -> null
- type = "spread" -> null
}
# (4 unchanged blocks hidden)
}
# module.people-depot.module.backend_dev_service.aws_ecs_service.fargate[0] will be updated in-place
!~ resource "aws_ecs_service" "fargate" {
id = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/people-depot-backend-dev"
name = "people-depot-backend-dev"
tags = {
"project" = "people-depot"
}
# (19 unchanged attributes hidden)
!~ ordered_placement_strategy {
!~ field = "attribute:ecs.availability-zone" -> "memory"
!~ type = "spread" -> "binpack"
}
- ordered_placement_strategy {
- field = "instanceId" -> null
- type = "spread" -> null
}
# (4 unchanged blocks hidden)
}
# module.vrms.module.backend_dev_service.aws_ecs_service.fargate[0] will be updated in-place
!~ resource "aws_ecs_service" "fargate" {
id = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/vrms-backend-dev"
name = "vrms-backend-dev"
tags = {
"project" = "vrms"
}
# (19 unchanged attributes hidden)
!~ ordered_placement_strategy {
!~ field = "attribute:ecs.availability-zone" -> "memory"
!~ type = "spread" -> "binpack"
}
- ordered_placement_strategy {
- field = "instanceId" -> null
- type = "spread" -> null
}
# (4 unchanged blocks hidden)
}
# module.vrms.module.backend_prod_service.aws_ecs_service.fargate[0] will be updated in-place
!~ resource "aws_ecs_service" "fargate" {
id = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/vrms-backend-prod"
name = "vrms-backend-prod"
tags = {
"project" = "vrms"
}
# (19 unchanged attributes hidden)
!~ ordered_placement_strategy {
!~ field = "attribute:ecs.availability-zone" -> "memory"
!~ type = "spread" -> "binpack"
}
- ordered_placement_strategy {
- field = "instanceId" -> null
- type = "spread" -> null
}
# (4 unchanged blocks hidden)
}
# module.vrms.module.frontend_dev_service.aws_ecs_service.fargate[0] will be updated in-place
!~ resource "aws_ecs_service" "fargate" {
id = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/vrms-frontend-dev"
name = "vrms-frontend-dev"
tags = {
"project" = "vrms"
}
# (19 unchanged attributes hidden)
!~ ordered_placement_strategy {
!~ field = "attribute:ecs.availability-zone" -> "memory"
!~ type = "spread" -> "binpack"
}
- ordered_placement_strategy {
- field = "instanceId" -> null
- type = "spread" -> null
}
# (4 unchanged blocks hidden)
}
# module.vrms.module.frontend_prod_service.aws_ecs_service.fargate[0] will be updated in-place
!~ resource "aws_ecs_service" "fargate" {
id = "arn:aws:ecs:us-west-2:035866691871:service/incubator-prod/vrms-frontend-prod"
name = "vrms-frontend-prod"
tags = {
"project" = "vrms"
}
# (19 unchanged attributes hidden)
!~ ordered_placement_strategy {
!~ field = "attribute:ecs.availability-zone" -> "memory"
!~ type = "spread" -> "binpack"
}
- ordered_placement_strategy {
- field = "instanceId" -> null
- type = "spread" -> null
}
# (4 unchanged blocks hidden)
}
Plan: 0 to add, 11 to change, 0 to destroy.❌ Error applying plan in Terraform apply (OIDC) #104 |
ale210
added a commit
that referenced
this pull request
Oct 10, 2026
For #255. Fixes the failed apply from #263. #263's apply rejected all ten ECS service updates: *"Availability Zone Rebalancing only supports availability zone spread as task placement strategy."* Every service has AZ rebalancing enabled, which allows only AZ-spread placement, so the new `binpack` was refused. The launch template change in the same apply succeeded (version 10, `t3a.medium`). The services were left untouched and still serve normally. This sets `availability_zone_rebalancing = "DISABLED"` on `aws_ecs_service`. The cluster is one host in one Availability Zone, so there is nothing to rebalance across. Comments that cited AZ rebalancing as the reason `deployment_maximum_percent` stays at 200 now give the real reason: production starts its new task before stopping the old one. **Expected plan: 0 to add, 10 to change, 0 to destroy.** Each ECS service is updated in place, with `availability_zone_rebalancing` going to `DISABLED` and the placement strategy going to `binpack` on `memory`. The provider sends both changes in one `UpdateService` call. If ECS still rejects the placement because rebalancing has to be off first, the apply fails the same harmless way as #263's, and the fallback is a PR that changes only the rebalancing setting. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This was referenced Oct 10, 2026
ale210
added a commit
that referenced
this pull request
Oct 10, 2026
For #255. Comment-only. The comment explaining why `aws_ecs_service` has no `create_before_destroy` still reasoned about ENI slots on two `m5.large` hosts. Every task is bridge-mode now and the cluster is one `t3a.medium`, so the reason is memory: a duplicate service doubles its reservation on a host with about 1 GB to spare. This was the one stale comment left out of #263. **Expected plan: no changes.**
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
For #255. Shrinks the ECS cluster to one
t3a.medium, now that every service uses bridge networking (#254) and nothing needs an ENI.platform/compute.tf:instance_typem5.large→t3a.medium;desired_capacity2 → 1 (inignore_changes, so this only keeps the code honest).max_size = 2stays as the slot for replacing an instance without an outage.modules/container/main.tf: the twospreadplacement strategies become onebinpackonmemory.m5.largenow reason about memory on one host, inmain.tf,compute.tfandiam.tf. The service lifecycle comment aboveaws_ecs_service'slifecycleblock still describes ENIs and needs the same rewording.Expected plan: launch template updated in place (mints version 10,
t3a.medium,metadata_optionsunchanged), and all ten ECS services updated in place forordered_placement_strategy. Nothing replaced. The ASG should show no change. Changing the placement strategy may start a new deployment of each service; production deploys at 100/200 and stays up, non-production at 0/200 may blip briefly.Merging changes no running instance. The host swap is manual and comes after merge, as set out in #255: drain and terminate one
m5.large, launch thet3a.medium, then drain and terminate the other.Sizing, checked 2026-10-10: the ten tasks reserve 2,816 MiB against an estimated ~3,850 MiB registered on a
t3a.medium. Seven-day CPU across both current hosts averages about 7% of a 2-vCPU instance, inside the 20% burst baseline.