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
Engineering approach
- Review the existing estate read-only, inventory resources and rank risks before changing anything.
- Separate environments into their own AWS accounts and define the network and access model first.
- Capture infrastructure in Terraform modules, importing existing resources in stages and checking that plans show no unintended changes.
- Replace long-lived keys with short-lived credentials from GitHub OIDC and role-based access.
- 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
- Review Read-only inventory of resources, access, cost drivers and deployment steps.
- Foundation Account structure, network, IAM roles and remote Terraform state with locking.
- Codify Terraform modules for network, compute and data. Existing resources imported in stages.
- Pipelines CI for tests and image builds, CD with staging verification and gated production releases.
- 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.