Skip to content
Annas Ali

CI/CD platform

Serverless Jenkins on AWS Fargate

A Jenkins controller and on-demand Docker build agents on ECS Fargate, built with Terraform, with no build servers to patch.

  • Jenkins
  • ECS Fargate
  • Terraform
  • EFS
  • CloudWatch
  • AWS Backup

The problem

Self-managed Jenkins servers are a quiet source of toil. Someone has to patch the OS, size the build agents, and watch the disks fill up. The goal was to keep Jenkins but remove the servers.

Serverless Jenkins on ECS FargateECS CLUSTER · FARGATEEngineersHTTPSRoute 53ALBJenkins controllerFargate taskBuild agentsECS Fargate plugin · on demandAWS BackupAmazon EFSJENKINS_HOMECloudWatchlogs · alarmsSNSalertsaliasspawnmountsnapshotlogs
The controller runs as a Fargate task with its state on EFS. Build agents are short-lived Fargate tasks launched per job.

What I built

  • Jenkins on ECS Fargate, fully in Terraform. Controller, networking, storage and monitoring all come up from one codebase.
  • Docker-based build agents launched on demand through the ECS Fargate plugin. Capacity scales with the build queue, and nothing sits idle.
  • Reliability and DR: Route 53 for a stable endpoint, CloudTrail for auditing, CloudWatch logs and alarms with SNS notifications, and AWS Backup for the Jenkins home volume.

Stack

Jenkins · Amazon ECS (Fargate) · ECS Fargate plugin · Terraform · Amazon EFS · Application Load Balancer · Route 53 · CloudWatch · SNS · CloudTrail · AWS Backup

Next case study

Temporary Elevated Access Management (AWS TEAM) →