Engineering and Technology | Open Access | DOI: https://doi.org/10.37547/tajet/Volume07Issue09-14

Lightweight Deployment of AWS ECS Without Configuration Drift

Sergey Bolshakov , DevOps Lead, Raiffeisenbank Czech Republic, Prague, Czech Republic , USA

Abstract

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.

Keywords

References

Amazon Web Services Inc. 2025. Containers And Serverless Recommendation Guide. Available at https://aws.amazon.com/ru/modern-apps/recommendation-guide/serverless/amazon-ecs/ (accessed June 20, 2025).

Atlassian. 2024. Link GitHub workflows and deployments to Jira work items. Available at https://support.atlassian.com/jira-cloud-administration/docs/link-github-workflows-and-deployments-to-jira-issues/ (accessed July 10, 2025).

dtiziani. 2021. Keep the LATEST aws_ecs_task_definition container_definition image revision. Available at https://github.com/hashicorp/terraform-provider-aws/issues/20121 (accessed July 18, 2025).

Edstrom A. 2024. The recommended workaround for ignoring task definition changes causes the service’s container definitions to be overwritten on every Terraform apply, even ones that don’t touch the service. Available at https://github.com/terraform-aws-modules/terraform-aws-ecs/issues/165 (accessed June 25, 2025).

Ewbank K. 2024. r/aws_ecs_task_definition: add track_latest attribute. Available at https://github.com/hashicorp/terraform-provider-aws/pull/30154 (accessed June 26, 2025).

Firefly. 2025. Terraform and Kubernetes: Monitoring Drift in Clusters. Available at https://www.firefly.ai/academy/terraform-and-kubernetes-monitoring-drift-in-clusters (accessed July 12, 2025).

GitHub. 2025a. Deploying to Amazon Elastic Container Service. Available at https://docs.github.com/en/actions/how-tos/managing-workflow-runs-and-deployments/deploying-to-third-party-platforms/deploying-to-amazon-elastic-container-service (accessed June 30, 2025).

GitHub Actions. 2025. amazon-ecs-render-task-definition. Available at https://github.com/aws-actions/amazon-ecs-render-task-definition (accessed June 27, 2025).

Google Cloud. 2023. State of DevOps Report 2023. Available at https://services.google.com/fh/files/misc/2023_final_report_sodr.pdf (accessed July 10, 2025).

Google Cloud. 2025. What is Cloud Run? Available at https://cloud.google.com/run/docs/overview/what-is-cloud-run (accessed July 15, 2025).

HashiCorp. 2024a.Estimate HCP Terraform cost. Available at https://developer.hashicorp.com/terraform/cloud-docs/overview/estimate-hcp-terraform-cost (accessed June 21, 2025).

HashiCorp. 2024b.Use refresh-only mode to sync the Terraform state. Available at https://developer.hashicorp.com/terraform/tutorials/state/refresh (accessed June 24, 2025).

HashiCorp. 2024c.Lambda Provisioned Concurrency cannot be Changed Simultaneously with an Alias. Available at https://github.com/hashicorp/terraform-provider-aws/issues/13329 (accessed July 16, 2025).

HashiCorp. 2025a.command: plan. Available at https://developer.hashicorp.com/terraform/cli/commands/plan (accessed July 4, 2025).

HashiCorp. 2025b.Resource: aws_lambda_alias. Available at https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_alias (accessed July 14, 2025).

Ivan Sukhomlyn. 2024. Use `track_latest` attribute for the `aws_ecs_task_definition` resource at the `service` module. Available at https://github.com/terraform-aws-modules/terraform-aws-ecs/issues/169 (accessed July 10, 2025).

Microsoft. 2020.Developer Velocity. Available at https://azure.microsoft.com/en-us/solutions/developer-velocity (accessed July 28, 2025).

Microsoft. 2025. Manage revisions in Azure Container Apps. Available at https://learn.microsoft.com/en-us/azure/container-apps/revisions-manage (accessed July 17, 2025).

Article Statistics

Copyright License

Download Citations

How to Cite

Sergey Bolshakov. (2025). Lightweight Deployment of AWS ECS Without Configuration Drift. The American Journal of Engineering and Technology, 7(09), 195–202. https://doi.org/10.37547/tajet/Volume07Issue09-14