Skip to content

Deployment

Source: src/AWS/ApiGateway/Deployment.ts

A point-in-time snapshot of a REST API, ready to be served through a Stage.

A Deployment captures whatever methods, integrations, resources, and authorizers currently exist on the REST API and produces an immutable deploymentId that a Stage can point at. Pass the RestApi value on restApi and Alchemy handles all the ordering for you — the deployment will run after every method bound to the API.

const api = yield* ApiGateway.RestApi("Api", {
endpointConfiguration: { types: ["REGIONAL"] },
});
yield* ApiGateway.Method("GetRoot", {
restApi: api,
httpMethod: "GET",
authorizationType: "NONE",
integration: { type: "MOCK" },
});
const deployment = yield* ApiGateway.Deployment("Release", {
restApi: api,
description: "v1",
});

Usually you do not have to: restApi already makes the Deployment depend on every method, so any change to a method re-plans a new deployment. Use triggers when you want to couple the deployment to a signal Alchemy cannot see — for example, a manual version bump or a hash of configuration computed outside the stack.

const deployment = yield* ApiGateway.Deployment("Release", {
restApi: api,
triggers: { version: "2026-05-01" },
});

CloudFormation’s AWS::ApiGateway::Deployment famously requires a hand-written DependsOn: [Method1, Method2, ...] listing every method. Alchemy derives that list automatically from the bindings registered on the RestApi, so adding a method never requires editing the deployment.