Optional ReadonlybuildThe CodeBuild build image to use for the synth step.
The default image (Amazon Linux 2023 standard:5.0) includes Node 22 and Amazon Linux 2023. Override this if you need a different OS or runtime set.
Optional ReadonlycommandsShell commands to run during the synth step.
['npm ci', 'npx cdk synth'] — installs dependencies and synthesizes the CDK app.
Override if you need Node version upgrades, custom build steps, or a non-standard cdk.json app path.
If your app requires Node 22+, prepend 'n 22' to commands or use installCommands.
Optional ReadonlycomputeCodeBuild compute type for the synth step.
Controls the CPU/memory allocation for the build environment. Increase this if you encounter OOM (exit code 137) during synth/bundling.
SMALL: 2 vCPU, 3 GBMEDIUM: 4 vCPU, 7 GBLARGE: 8 vCPU, 15 GBOptional ReadonlydockerWhether to enable Docker for the synth step.
Required when your CDK app uses Docker image assets (e.g., Lambda container images, ECS task definitions with Dockerfile builds).
Optional ReadonlyenvEnvironment variables available during synth.
Note: NODE_OPTIONS is automatically prepended with --conditions=cdk
(required for ESM conditional exports). Your custom NODE_OPTIONS will be
appended after this flag.
Optional ReadonlyinstallCommands to run in the CodeBuild install phase (before synth commands).
Optional ReadonlypartialA partial CodeBuild BuildSpec merged into the synth step's generated buildspec.
Use this to control the synth runtime declaratively, most commonly to pin
the Node.js version via runtime-versions. It merges with (does not replace)
the install/build commands generated from installCommands and
commands, and is orthogonal to the NODE_OPTIONS environment variable
injection (one configures the buildspec, the other sets an env var).
Three behaviors, selected by the value you pass:
undefined): the synth step gets a default BuildSpec pinning
the Node.js 22 runtime (see @default below). This is the recommended path.null: explicit opt-out. No partialBuildSpec is injected at all, so
the synth buildspec carries no runtime-versions block. Use this when you
want to control the runtime yourself, for example by installing a Node
version via installCommands (such as ['n 20']) or by relying on
the build image's built-in runtime without any merged buildspec.BuildSpec: used as-is, replacing the Node.js 22 default.a BuildSpec declaring the Node.js 22 runtime:
BuildSpec.fromObject({ phases: { install: { 'runtime-versions': { nodejs: 22 } } } }).
Override with a BuildSpec to select a different runtime or add other
buildspec-only settings, or pass null to disable the default entirely.
Optional ReadonlyprimaryPrimary output directory for the CDK cloud assembly.
Override this for monorepos where cdk synth outputs to a
subdirectory (e.g., packages/infra/cdk.out).
Configuration for the synth step (build + CDK synth).
The synth step installs dependencies and runs
cdk synthto produce the CloudFormation template. The pipeline is self-mutating: if the synth output changes the pipeline definition, it updates itself first.