Skip to main content

Cost-Efficient AWS Infrastructure, Disaster Recovery & GitOps CI/CD (CircleCI + ArgoCD)

· 3 min read
Ilham Surya
Platform Engineer (Engineering Infra) - SRE & Agentic AI - Go, Python, TypeScript

Shipping fast is only half of cloud operations—the other half is keeping AWS bills under control and making sure your services actually survive when a server, availability zone, or deployment goes sideways.

Here is the practical setup I lean on across CI/CD (CircleCI + ArgoCD), AWS cost hygiene, and disaster recovery (DR).

1. Splitting CI and CD Cleanly: CircleCI + ArgoCD​

Trying to cram build steps, security scans, and direct kubectl apply cluster credentials into one pipeline gets messy and risky quickly. Separating CI from CD via GitOps keeps production far cleaner:

  1. CircleCI (CI): Runs on every pull request and merge—linting, unit/integration tests, static checks, building immutable Docker images tagged with the Git SHA, and pushing them to the container registry.
  2. ArgoCD (CD / GitOps): Watches the deployment manifest repository (Helm/Kustomize). Updating an image tag in Git automatically reconciles the Kubernetes cluster to the declared state.

Why this pays off in production:

  • Zero cluster credentials in CI runners—ArgoCD pulls from Git inside the cluster.
  • Instant, auditable rollbacks—rolling back a bad release is just reverting a Git commit or clicking rollback in ArgoCD.
  • Drift detection—manual hotfixes made directly in the cluster are flagged immediately instead of turning into snowflake servers.

2. Practical AWS Cost Efficiency Levers​

Cloud bills rarely explode from one obvious mistake; they creep up from dozens of forgotten defaults. The highest-ROI checks I run regularly:

  • Right-size compute before committing: Look at P95 CPU/memory usage over 14–30 days—most staging and internal services are over-provisioned by 2–3×.
  • Match purchase models to workload stability: Use Savings Plans / Reserved Instances for steady baseline workloads (databases, core API nodes) and Spot Instances for stateless workers, CI runners, and burst batch jobs.
  • Audit NAT Gateway & cross-AZ data transfer: Pulling container images or hitting S3 through a NAT Gateway instead of VPC Gateway Endpoints silently burns budget every month.
  • Set retention policies on everything: Add lifecycle rules on S3 buckets (transition old artifacts/backups to Glacier or expire them), cap CloudWatch/ELK log retention, and clean up unattached EBS volumes and old snapshots.
  • Schedule non-prod environments: Automatically scale down dev/staging clusters outside working hours when teams aren't using them.

3. Disaster Recovery That Works Under Pressure​

Disaster recovery starts by agreeing on two real numbers with the business before designing anything:

  • RPO (Recovery Point Objective): How much data loss is acceptable (minutes vs. hours)?
  • RTO (Recovery Time Objective): How fast must the service be back online?

From there, keep the DR playbook simple and testable:

  • Infrastructure as Code (Terraform / GitOps): Never depend on someone remembering console clicks during an outage—every VPC, IAM policy, load balancer, and cluster manifest should be reproducible from Git.
  • Multi-AZ by default for stateful tiers: Run primary databases and Redis/Kafka across multiple Availability Zones, with cross-region automated backups for critical data.
  • Automated health checks & runbooks: Document the exact failover order (DNS/load balancer cutover → database promotion → cache warm-up → traffic verification) and run periodic game days or controlled instance terminations so the team finds broken assumptions on a Tuesday afternoon instead of during a live outage.