
The diagram source is the draw.io file at
images/software/developer/estate/infra/talentidpipeline-infra-cdk/architecture.drawio. To change the diagram, edit that source in draw.io, re-export it as PNG to architecture.png in the same folder, and commit both.Overview
This repo is a single AWS CDK (Python) application. It does not deploy resources directly. Instead it defines a self-mutating CodePipeline that deploys everything. The whole estate’s core infrastructure therefore flows through one pipeline, in one AWS account, in one region.High-Level Structure
The application is a single CDK app that builds a pipeline, which deploys a stage containing three stacks:- The CDK app (
app.py) contains the pipeline stack (TalentIPipelineStack, deployed asTalentId-Infra-Pipeline). - The pipeline stack creates the CodeCommit source repo (
TalentIdPipeline-Infra-CDK) and the self-mutating CodePipeline (TalentId-CDKPipeline-Infra). - The pipeline runs one stage, named
Infra, which deploys three stacks in dependency order:TalentID-Infra-External-Dependencies, thenTalentID-Infra, thenTalentId-MongoInstance.
The CI/CD Pipeline
The pipeline is a CDKCodePipeline construct with the following characteristics:
- Source: the
mainbranch of the CodeCommit repoTalentIdPipeline-Infra-CDK. The pipeline also creates this repo. - Synth step: runs
npm install -g aws-cdk, thenpip install -r requirements.txt, thennpx cdk synth. - Self-mutation is enabled, so the pipeline updates itself from the latest code before deploying the stacks.
- Assets are published one at a time rather than in parallel.
- A dedicated S3 artifact bucket (
build-assets-talent-id-infra) holds pipeline artifacts.
The Three Stacks and Their Ordering
The singleInfra stage deploys three stacks, with explicit dependencies so they roll out in the correct order:
TalentID-Infra-External-Dependenciesresolves shared resources (buckets, IAM users, the API repo) and publishes their identifiers to SSM.TalentID-Infrabuilds the VPC, security groups, the API Gateway VPC endpoint and SNS topics. It consumes the external-dependencies configuration and depends on stack 1.TalentId-MongoInstanceprovisions the MongoDB EC2 instance into the VPC and security group created by stack 2, and depends on stack 2.
/TalentId/Infra/ that downstream systems read at deploy time. See Integration Surface and Configuration Contract.
How a Change Reaches Production
1
Merge to main
A change is merged to
main in the CodeCommit repo.2
Pipeline triggers
TalentId-CDKPipeline-Infra triggers automatically.3
Synth
The Synth step installs the CDK CLI and Python dependencies and runs
cdk synth.4
Self-mutate
The pipeline self-mutates, applying any change to the pipeline itself.
5
Deploy
The
Infra stage deploys the three stacks in dependency order.Why It Is Built This Way
- Python CDK (off-standard). The team’s preferred IaC is TypeScript CDK. This repo is Python for historical reasons (originally built by Nick from AWS for TalentID). It works, but it raises the maintenance bar and is part of why SG-Infra is the go-forward pattern.
- Single account, region and environment. There is no separate dev or prod AWS environment in this app. Instead the one Mongo instance hosts many databases (the dev and prod databases for the systems that use it, of which
TalentId_DEVandTalentId_PRODare examples), so dev and production data share the same hardware and network. - Self-mutating pipeline. Convenient, because the pipeline maintains itself, at the cost of pipeline changes also being applied automatically.
