AWS Infrastructure & CI/CD Modernization

Moving a console-built AWS environment to Terraform and automated, auditable deployments.

Project overview

Client
Confidential client (under NDA)
Industry
Software and technology
Role
Principal DevOps Engineer (sole engineer on the infrastructure workstream)
Scope
AWS architecture, Infrastructure as Code, CI/CD, cost review

Business challenge

  • Production ran on resources created by hand in the AWS console, so nobody could reproduce the environment or explain every change.
  • Releases were manual and depended on one person, which slowed delivery and raised the risk of mistakes.
  • Cloud spend was growing without a clear view of which resources justified their cost.

Existing infrastructure

  • Single AWS account holding development, staging and production workloads.
  • EC2 instances in a flat network, deployed by copying files and restarting services over SSH.
  • Shared long-lived access keys used by people and by scripts.
  • No version-controlled infrastructure and no automated tests before release.

Architecture

Target architecture: AWS with Terraform and GitHub ActionsFour layers from top to bottom: source and CI, delivery, runtime, and foundation. GitHub Actions builds and pushes images to ECR, ECS runs the services behind an Application Load Balancer, and Terraform manages the multi-account network and data foundation.Source & CIGitHub repoGitHub ActionsImage scanDeliveryAmazon ECRStaging deployApproved prod deployRuntimeALB + WAFECS servicesRDS (Multi-AZ)S3FoundationSeparate AWS accountsVPC, private subnetsTerraform state + IAM
Target architecture: AWS with Terraform and GitHub Actions. Simplified to protect client confidentiality.

Engineering approach

  1. Review the existing estate read-only, inventory resources and rank risks before changing anything.
  2. Separate environments into their own AWS accounts and define the network and access model first.
  3. Capture infrastructure in Terraform modules, importing existing resources in stages and checking that plans show no unintended changes.
  4. Replace long-lived keys with short-lived credentials from GitHub OIDC and role-based access.
  5. Build pipelines that test, scan, build and deploy, with a manual approval gate for production.

Technologies used

  • AWS
  • Terraform
  • GitHub Actions
  • Amazon ECS
  • Amazon ECR
  • RDS
  • AWS WAF
  • IAM

Security considerations

  • Per-environment accounts limit the blast radius of mistakes or compromise.
  • Least-privilege roles replace shared access keys. Pipelines assume roles through OIDC.
  • Secrets are held in a managed secret store, never in repositories or pipeline variables.
  • Data is encrypted at rest and in transit, and databases sit in private subnets.
  • Audit logging is enabled so that infrastructure changes can be traced to a commit.

Implementation

  1. Review Read-only inventory of resources, access, cost drivers and deployment steps.
  2. Foundation Account structure, network, IAM roles and remote Terraform state with locking.
  3. Codify Terraform modules for network, compute and data. Existing resources imported in stages.
  4. Pipelines CI for tests and image builds, CD with staging verification and gated production releases.
  5. Cutover Traffic moved per service with rollback ready, followed by documentation and handover.

Results and improvements

Technical improvements

  • Environments can be recreated from code, and every change is reviewed in a pull request.
  • Releases are repeatable and no longer depend on one person.
  • Long-lived credentials are removed from people and pipelines.
  • Spend can be attributed to services through tagging and budgets.

Lessons learned

  • Importing existing resources in small steps is slower than rebuilding, but it avoids downtime.
  • Fix the access model before the pipelines, or pipelines inherit the old credential problems.
  • A short runbook for rollback is worth more than a long architecture document.

Related services

Facing a similar challenge?

Share your current setup and goals, and I will suggest a practical approach.

Discuss Your Project