Skip to main content
The Buildkite pattern is a standalone CDK construct (Buildkite) that provisions a complete CI/CD stack on AWS. Compose it into your own CDK app and deploy with cdk deploy. It is not a fjall create option.

Prerequisites

  • Node 22 or later
  • AWS CDK installed (npm install -g aws-cdk)
  • @fjall/components-infrastructure added to your project
  • A Buildkite agent token from your Buildkite organisation settings

What it provisions

Agents poll the Buildkite API for jobs, so the stack creates no load balancer.

Quick start

Instantiate the construct in your CDK app:
BuildkiteDefaultProps supplies sensible defaults for every required field, so spread it first and override only what you need. Set the agent token in your shell before synthesis, then deploy:
The agent token is read at synthesis time from the BUILDKITE_AGENT_TOKEN environment variable and written to AWS SSM Parameter Store as a SecureString at /buildkite/agentToken, encrypted with a dedicated KMS key. If you skip the environment variable, set the parameter value in SSM after deployment.

Configuration

Override defaults by passing props alongside the BuildkiteDefaultProps spread:

Core parameters

Agent configuration

Scaling configuration

Storage and logging

Docker configuration

Security and networking

Advanced parameters

Cost optimisation

The pattern includes several cost-saving features:
  • Spot instances: save up to 90% on compute costs.
  • Auto-scaling: pay only for the agents you run.
  • Configurable retention: keep CloudWatch logs only as long as you need them.
Estimated monthly cost is 50to50 to 200 depending on usage.

Customisation

Queue-based agents

Target a specific Buildkite queue:

Docker and ECR integration

Enable ECR and Docker plugins for container workflows:

SSH access for debugging

Attach an existing EC2 key pair for SSH access:

Monitoring

Agent logs flow to CloudWatch with the retention set by logRetentionDays. View instance health, scaling activity, and agent logs in the AWS console under EC2 Auto Scaling Groups and CloudWatch Logs for the stack’s region.

Next Steps

Compute Factory

Configure ECS and Lambda compute

Storage Factory

Configure S3 buckets for artifacts