Deployment
Source:
src/AWS/ApiGateway/Deployment.ts
A point-in-time snapshot of a REST API, ready to be served through a
Stage.
Creating a deployment
Section titled “Creating a deployment”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",});Forcing a redeploy
Section titled “Forcing a redeploy”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" },});Why no DependsOn?
Section titled “Why no DependsOn?”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.