Lightweight Deployment of AWS ECS Without Configuration Drift - Sergey Bolshakov (Emerging Frontiers Library for The American Journal of Engineering and Technology, 2025)
Background: In the containerized architecture on Fargate design, business logic resides within the API repository, and an infrastructure repository contains a description of the infrastructure. Since startups must iterate rapidly and deploy new versions frequently, a fast and reliable CI/CD pipeline is critical, regardless of the chosen container platform. The regular solutions are either expensive and slow ones (such as Terraform Cloud, Atlantis, or Spacelift), or even if you have a self-hosted plan, or even with a self‑hosted Terraform pipeline, running a full plan/apply for every deployment is slow and adds unacceptable latency to releases in an MVP or startup context between the Terraform state and the actual cloud configuration. Methods: A typical process utilizing the track_latest property, which was added in February 2024 — specifically, version 5.37.0 of the Terraform AWS Provider. Concurrently, the Terraform configuration invokes data.aws_ecs_container_definition with track_latest = true, so that a subsequent Terraform plan compares not with the ARN stored in the state file, but with the latest revision in the cloud. Results: Across a sample of 50 releases, the complete cycle was reduced from 9.6 ± 1.1 minutes to 1.9 ± 0.2 minutes—an approximately 80 % acceleration. Once track_latest was enabled, all subsequent Terraform plan executions in the three environments completed with no changes. Infrastructure is up‑to‑date, eliminating drift. Conclusions: Enabling the track_latest attribute in the Terraform AWS Provider enables a lightweight, secure, and deployment of ECS services without the need for external CI tools or workaround scripts. A single configuration parameter supplants expensive and complex solutions, preserving Terraform’s declarative paradigm and automatically preserving Terraform’s declarative paradigm and preventing drift—Terraform plan compares against the live revision. At the same time, the state file itself retains the prior ARN. The method’s limitations are the requirement for a provider version ≥ v5.37.0 and for tracking environment variable changes made outside of Terraform.