Skip to content

Version

Source: src/AWS/Lambda/Version.ts

An immutable numbered version of a managed Lambda function.

The provider publishes only after the Function’s code and configuration have settled. Re-applying unchanged code and versioned configuration reuses the existing version. Function-level operational changes, such as reserved concurrency, do not publish a new version.

Versions default to retain on removal. Moving or deleting an alias never deletes an older version, so in-flight durable executions can continue replaying against the code that started them. Use destroy() only when the exact numbered version is safe to remove.

const fn = yield* AWS.Lambda.Function("Handler", {
main: import.meta.resolve("./handler.ts"),
});
const version = yield* AWS.Lambda.Version("HandlerVersion", {
function: fn,
});
const version = yield* AWS.Lambda.Version("CampaignRunVersion", {
function: campaign.function,
});
const live = yield* AWS.Lambda.Alias("CampaignRunLive", {
version,
aliasName: "live",
});
import { destroy } from "alchemy/RemovalPolicy";
const disposable = yield* AWS.Lambda.Version("PreviewVersion", {
function: fn,
}).pipe(destroy());