Self-hosted (AWS)

Existing infrastructure and exposure

Reuse your own VPC, database, cluster, certificate or DNS, and choose between CloudFront and private-only access.

Deployment
Self-hosted
Area
Install

You can reuse your own VPC, database, ECS cluster, certificate, registry or DNS, and choose whether Diakrin is public through CloudFront or private only.

Before you start

You supplyExampleComes from
The IDs of what you reusevpc-0abc…, a certificate ARNYour AWS account
A settings filediakrin.envSee Install

Anything you do not set is created. Diakrin never deletes a resource you supplied. infra up checks everything you reuse before it changes anything, and each failure prints its fix.

Reuse what you have

Add the settings you need to diakrin.env, one KEY=VALUE per line, then run infra up as usual.

SettingReuses
DIAKRIN_VPC_IDA VPC. Needs DIAKRIN_PRIVATE_SUBNET_IDS in two or more Availability Zones
DIAKRIN_PRIVATE_SUBNET_IDSThe private subnets of that VPC
DIAKRIN_PUBLIC_SUBNET_IDSPublic subnets, only for a public load balancer
DIAKRIN_SECURITY_GROUP_IDSSecurity groups for the workloads
DIAKRIN_ECS_CLUSTER_ARNAn ECS cluster
DIAKRIN_ALB_LISTENER_ARNAn HTTPS listener on your load balancer. Needs DIAKRIN_VPC_ID
DIAKRIN_CERTIFICATE_ARNA regional ACM certificate for the load balancer
DIAKRIN_CLOUDFRONT_CERTIFICATE_ARNAn ACM certificate for CloudFront. It must be in us-east-1
DIAKRIN_KMS_KEY_ARNA KMS key
DIAKRIN_ECR_REGISTRYAn ECR registry host
DIAKRIN_AUDIT_BUCKETAn S3 audit bucket with Object Lock
DIAKRIN_DATABASE_SECRET_ARNA Secrets Manager secret holding an existing database (JSON host, port, username, password, dbname)
DIAKRIN_DATABASE_URLAn existing PostgreSQL database. A secret: see below
DIAKRIN_WEBHOOK_URLAn existing GitHub webhook endpoint instead of the one Diakrin creates
DIAKRIN_DNSexternal (any provider, the default) or route53
DIAKRIN_ROUTE53_ZONE_IDThe Route 53 zone for validation and host records

DIAKRIN_DATABASE_URL and DIAKRIN_DATABASE_SECRET_ARN are exclusive. Never put the URL in diakrin.env; the CLI refuses it. Pass it in the process environment for one run, and the CLI moves it to Secrets Manager:

sh
DIAKRIN_DATABASE_URL='postgresql://user:password@host:5432/db' diakrin self-hosted infra up --env diakrin.env --plan-only

You should see the plan list what is reused and what is created. If you already have everything, you can skip infra up and run deploy straight away; it validates the same settings.

Exposure

DIAKRIN_EXPOSE decides how people and GitHub reach Diakrin. The load balancer is always internal.

ValueWhat you getUse it when
cloudfront (default)CloudFront with a VPC origin in front of the internal ALB, AWS WAF, and https://<host> on the internetYou want to open the console from anywhere. Needs an internet gateway on the VPC
noneNo CloudFront. People use VPN, peering or PrivateLink. GitHub reaches one API Gateway webhook endpointDiakrin must stay private

With cloudfront, AWS WAF lets only GitHub's source ranges reach the webhook path. Use DIAKRIN_ALLOWED_CIDRS to limit who can reach everything else.

For none, choose how your network reaches Diakrin:

SettingValueMeaning
DIAKRIN_PRIVATE_ACCESSpeering (default)VPC peering, optionally to DIAKRIN_PEER_VPC_ID
DIAKRIN_PRIVATE_ACCESSprivatelinkAn endpoint service for the IAM principals in DIAKRIN_PRIVATELINK_PRINCIPALS
DIAKRIN_EGRESSdirect (default)Outbound through one NAT gateway
DIAKRIN_EGRESSfirewallOutbound through your firewall at DIAKRIN_TRANSIT_GATEWAY_ID. It must allow GitHub, the Diakrin image registry and Diakrin license checks

If it fails

You seeIt meansDo this
VALIDATION_FAILED naming an internet gatewayCloudFront VPC origins need an internet gateway on the VPCAttach one, or set DIAKRIN_EXPOSE=none
EXPOSE_NEEDS_IGWFirewall egress with a new VPC creates no internet gatewaySet DIAKRIN_EXPOSE=none, or reuse a VPC that has one
EXPOSE_PUBLICA public load balancer cannot be combined with CloudFrontUse DIAKRIN_INGRESS=private, or DIAKRIN_EXPOSE=none
DATABASE_BOTHBoth a database URL and a database secret are setSet only one
SECRET_IN_FILEA secret is in diakrin.envMove it to the process environment
BYO_SUBNETSDIAKRIN_VPC_ID needs private subnets in two zones, and subnets need a VPC idList two or more private subnet ids with DIAKRIN_VPC_ID

Next

Continue with Install.

Next stepInstall self-hosted Diakrin →