DevSecOps CI/CD & AWS Infrastructure
20 Nov, 2026
Overview
For the second half of my internship at PT Darmawan Aryansyah Teknologi (DAT) across the DevOps and IT Security divisions, I designed and implemented a production-style, security-first infrastructure and CI/CD pipeline for a multi-service demo application (frontend, backend, background worker, PostgreSQL, and Redis) within AWS Free Tier constraints.
Infrastructure & Security Design
- Infrastructure as Code (Terraform): Separated into a bootstrap layer (remote S3 state) and a main layer provisioning a VPC, public subnet, security groups, IAM roles, Elastic IP, SSM parameters, and GitHub Actions OIDC policies.
- Three-Instance Topology:
- Application Server (
t4g.smallARM64): Runs Nginx reverse proxy, frontend, backend, worker, PostgreSQL, Redis,node-exporter, andcAdvisor. Only HTTP/HTTPS ports are exposed publicly. - Monitoring Server (
t4g.smallARM64): Runs Prometheus, Grafana, and Alertmanager with zero public ingress rules. - Code Quality Server (
c7i-flex.largex86-64): Runs SonarQube and its companion PostgreSQL database with zero public ingress rules.
- Application Server (
- Zero-SSH & Secretless Access: Closed SSH ports across all instances. Server configuration is executed via AWS Systems Manager (SSM), GitHub Actions authenticates to AWS via OIDC (no static access keys), and operator access to Grafana and SonarQube is routed privately over Tailscale.
- Idempotent Configuration (Ansible): Five modular Ansible roles (
docker_engine,notes_app,notes_monitoring,notes_sonarqube,tailscale) usingdocker compose up -d --waitto enforce container health checks before proceeding.
Multi-Stage CI/CD & Observability
- CI (
ci.yml): Runs linting, unit tests, and SonarQube quality gate checks on code changes. Verified by intentionally injecting faulty code and SQL injection patterns, which the pipeline successfully blocked. - CD (
cd.yml): Builds ARM64 container images, scans them for vulnerabilities with Docker Scout, and pushes commit-SHA-tagged images to Docker Hub. - Deploy & Automatic Rollback (
deploy.yml): Validates the target commit SHA, re-scans the image, deploys via AWS SSMSendCommand, and verifies service health. Tested with an intentionally failing release: the deployment script automatically rolled back to thelast-goodstate to keep the service healthy while exiting with a failure code so the workflow accurately reported the failed release. - Monitoring & Alerting: Prometheus scrapes host and container metrics every 15 seconds (7-day retention), Grafana visualizes dashboards over Tailscale, and Alertmanager sends email alerts for instance downtime, high CPU, high memory, and low disk space.
Tech Stack
- AWS — EC2, VPC, IAM, SSM, S3, Elastic IP, OIDC
- IaC & Config — Terraform, Ansible
- Containers & Security — Docker, Docker Compose, Nginx, SonarQube, Docker Scout, Tailscale
- CI/CD — GitHub Actions, Docker Hub
- Observability — Prometheus, Grafana, Alertmanager, node-exporter, cAdvisor