AWS.CloudFormation reference
DescribeStackDriftDetectionStatus
Section titled “DescribeStackDriftDetectionStatus”Source:
src/AWS/CloudFormation/DescribeStackDriftDetectionStatus.ts
Runtime binding for the DescribeStackDriftDetectionStatus operation (IAM
action cloudformation:DescribeStackDriftDetectionStatus on * — the
detection id is not resource-scoped).
Polls a drift-detection run started with DetectStackDrift until it
reaches DETECTION_COMPLETE / DETECTION_FAILED and reports the stack’s
overall drift status. Provide the implementation with
Effect.provide(AWS.CloudFormation.DescribeStackDriftDetectionStatusHttp).
DescribeStackDriftDetectionStatus: Drift Detection
Section titled “DescribeStackDriftDetectionStatus: Drift Detection”const describeStackDriftDetectionStatus = yield* AWS.CloudFormation.DescribeStackDriftDetectionStatus();
const status = yield* describeStackDriftDetectionStatus({ StackDriftDetectionId: detectionId,});// status.DetectionStatus, status.StackDriftStatusDescribeStackEvents
Section titled “DescribeStackEvents”Source:
src/AWS/CloudFormation/DescribeStackEvents.ts
Runtime binding for the DescribeStackEvents operation (IAM action
cloudformation:DescribeStackEvents).
Bind this operation to a Stack to read its event history —
per-resource create/update/delete progress and failure reasons — from
inside a function runtime. Useful for deployment dashboards and failure
alerting. Provide the implementation with
Effect.provide(AWS.CloudFormation.DescribeStackEventsHttp).
DescribeStackEvents: Reading Stacks
Section titled “DescribeStackEvents: Reading Stacks”const describeStackEvents = yield* AWS.CloudFormation.DescribeStackEvents(stack);
const { StackEvents } = yield* describeStackEvents();const failures = (StackEvents ?? []).filter( (e) => e.ResourceStatus?.endsWith("_FAILED"),);DescribeStackResourceDrifts
Section titled “DescribeStackResourceDrifts”Source:
src/AWS/CloudFormation/DescribeStackResourceDrifts.ts
Runtime binding for the DescribeStackResourceDrifts operation (IAM action
cloudformation:DescribeStackResourceDrifts).
Bind this operation to a Stack to read per-resource drift results
after a DetectStackDrift run — which resources were MODIFIED or
DELETED out-of-band and the actual-vs-expected property differences.
Provide the implementation with
Effect.provide(AWS.CloudFormation.DescribeStackResourceDriftsHttp).
DescribeStackResourceDrifts: Drift Detection
Section titled “DescribeStackResourceDrifts: Drift Detection”const describeStackResourceDrifts = yield* AWS.CloudFormation.DescribeStackResourceDrifts(stack);
const { StackResourceDrifts } = yield* describeStackResourceDrifts({ StackResourceDriftStatusFilters: ["MODIFIED", "DELETED"],});DescribeStackResources
Section titled “DescribeStackResources”Source:
src/AWS/CloudFormation/DescribeStackResources.ts
Runtime binding for the DescribeStackResources operation (IAM action
cloudformation:DescribeStackResources).
Bind this operation to a Stack to resolve the physical ids of the
stack’s resources — e.g. look up a resource created by the template by its
logical id from inside a function runtime. Provide the implementation with
Effect.provide(AWS.CloudFormation.DescribeStackResourcesHttp).
DescribeStackResources: Reading Stack Resources
Section titled “DescribeStackResources: Reading Stack Resources”const describeStackResources = yield* AWS.CloudFormation.DescribeStackResources(stack);
const { StackResources } = yield* describeStackResources({ LogicalResourceId: "Param",});const physicalId = StackResources?.[0]?.PhysicalResourceId;DescribeStacks
Section titled “DescribeStacks”Source:
src/AWS/CloudFormation/DescribeStacks.ts
Runtime binding for the DescribeStacks operation (IAM action
cloudformation:DescribeStacks).
Bind this operation to a Stack to read its live status, parameters,
and template outputs from inside a function runtime — the classic
service-discovery pattern of resolving endpoints/ARNs from a stack’s
outputs. Provide the implementation with
Effect.provide(AWS.CloudFormation.DescribeStacksHttp).
DescribeStacks: Reading Stacks
Section titled “DescribeStacks: Reading Stacks”// init — bind the operation to the stackconst describeStacks = yield* AWS.CloudFormation.DescribeStacks(stack);
// runtimeconst { Stacks } = yield* describeStacks();const outputs = Stacks?.[0]?.Outputs ?? [];DetectStackDrift
Section titled “DetectStackDrift”Source:
src/AWS/CloudFormation/DetectStackDrift.ts
Runtime binding for the DetectStackDrift operation (IAM actions
cloudformation:DetectStackDrift + cloudformation:DetectStackResourceDrift
— AWS authorizes both on the per-stack call).
Bind this operation to a Stack to start drift detection from inside
a function runtime — e.g. a scheduled drift monitor. Detection runs
asynchronously; poll the returned StackDriftDetectionId with
DescribeStackDriftDetectionStatus. Note that CloudFormation reads
the live state of the stack’s resources with the caller’s credentials, so
the function also needs read access to the resource types in the template
for the detection to complete. Provide the implementation with
Effect.provide(AWS.CloudFormation.DetectStackDriftHttp).
DetectStackDrift: Drift Detection
Section titled “DetectStackDrift: Drift Detection”const detectStackDrift = yield* AWS.CloudFormation.DetectStackDrift(stack);
const { StackDriftDetectionId } = yield* detectStackDrift();GetTemplate
Section titled “GetTemplate”Source:
src/AWS/CloudFormation/GetTemplate.ts
Runtime binding for the GetTemplate operation (IAM action
cloudformation:GetTemplate).
Bind this operation to a Stack to read the deployed template body
from inside a function runtime — e.g. audit tooling that archives or diffs
the template actually running in the account. Provide the implementation
with Effect.provide(AWS.CloudFormation.GetTemplateHttp).
GetTemplate: Reading Stacks
Section titled “GetTemplate: Reading Stacks”const getTemplate = yield* AWS.CloudFormation.GetTemplate(stack);
const { TemplateBody } = yield* getTemplate();ListExports
Section titled “ListExports”Source:
src/AWS/CloudFormation/ListExports.ts
Runtime binding for the ListExports operation (IAM action
cloudformation:ListExports on * — exports are account-scoped).
Lists all cross-stack exported output values in the account and region —
runtime service discovery of values shared via Fn::ImportValue. Provide
the implementation with Effect.provide(AWS.CloudFormation.ListExportsHttp).
ListExports: Cross-Stack Exports
Section titled “ListExports: Cross-Stack Exports”const listExports = yield* AWS.CloudFormation.ListExports();
const { Exports } = yield* listExports();const apiUrl = Exports?.find((e) => e.Name === "ApiUrl")?.Value;ListImports
Section titled “ListImports”Source:
src/AWS/CloudFormation/ListImports.ts
Runtime binding for the ListImports operation (IAM action
cloudformation:ListImports on * — imports are account-scoped).
Lists the stacks importing a given exported output value — e.g. impact
analysis before rotating a shared value. Provide the implementation with
Effect.provide(AWS.CloudFormation.ListImportsHttp).
ListImports: Cross-Stack Exports
Section titled “ListImports: Cross-Stack Exports”const listImports = yield* AWS.CloudFormation.ListImports();
const { Imports } = yield* listImports({ ExportName: "ApiUrl" });ListStackResources
Section titled “ListStackResources”Source:
src/AWS/CloudFormation/ListStackResources.ts
Runtime binding for the ListStackResources operation (IAM action
cloudformation:ListStackResources).
Bind this operation to a Stack to enumerate all of the stack’s
resource summaries (paginated) from inside a function runtime — the
lighter-weight alternative to DescribeStackResources for stacks with many
resources. Provide the implementation with
Effect.provide(AWS.CloudFormation.ListStackResourcesHttp).
ListStackResources: Reading Stack Resources
Section titled “ListStackResources: Reading Stack Resources”const listStackResources = yield* AWS.CloudFormation.ListStackResources(stack);
const { StackResourceSummaries } = yield* listStackResources();const types = (StackResourceSummaries ?? []).map((r) => r.ResourceType);SignalResource
Section titled “SignalResource”Source:
src/AWS/CloudFormation/SignalResource.ts
Runtime binding for the SignalResource operation (IAM action
cloudformation:SignalResource).
Bind this operation to a Stack to send SUCCESS/FAILURE signals to a
resource with a CreationPolicy or a WaitCondition in the stack —
e.g. a function that performs out-of-band initialization and unblocks the
stack when done. Provide the implementation with
Effect.provide(AWS.CloudFormation.SignalResourceHttp).
SignalResource: Signaling Resources
Section titled “SignalResource: Signaling Resources”const signalResource = yield* AWS.CloudFormation.SignalResource(stack);
yield* signalResource({ LogicalResourceId: "WaitCondition", UniqueId: "init-1", Status: "SUCCESS",});Source:
src/AWS/CloudFormation/Stack.ts
An AWS CloudFormation stack — deploy an existing CloudFormation template from Alchemy as an interop/escape hatch.
Create and update are asynchronous: the provider submits the template and
then polls (bounded) until the stack reaches a terminal state, surfacing a
CREATE_FAILED / ROLLBACK_COMPLETE / UPDATE_ROLLBACK_COMPLETE status as
a typed error rather than hanging. An update whose template and parameters
are unchanged is a no-op (No updates are to be performed). Deletion waits
for DELETE_COMPLETE.
Stack: Deploying a Template
Section titled “Stack: Deploying a Template”Inline Template (SNS Topic)
const stack = yield* CloudFormation.Stack("Notifications", { templateBody: JSON.stringify({ Resources: { Topic: { Type: "AWS::SNS::Topic", Properties: { DisplayName: "alerts" } }, }, Outputs: { TopicArn: { Value: { Ref: "Topic" } } }, }),});// stack.outputs.TopicArn -> "arn:aws:sns:us-west-2:...:Notifications-Topic-..."Template with Parameters
const stack = yield* CloudFormation.Stack("Config", { templateBody: JSON.stringify({ Parameters: { Value: { Type: "String" } }, Resources: { Param: { Type: "AWS::SSM::Parameter", Properties: { Type: "String", Value: { Ref: "Value" } }, }, }, }), parameters: { Value: "hello" },});Stack: IAM Templates
Section titled “Stack: IAM Templates”const stack = yield* CloudFormation.Stack("Roles", { templateBody: iamTemplateJson, capabilities: ["CAPABILITY_NAMED_IAM"],});ValidateTemplate
Section titled “ValidateTemplate”Source:
src/AWS/CloudFormation/ValidateTemplate.ts
Runtime binding for the ValidateTemplate operation (IAM action
cloudformation:ValidateTemplate on * — validation is not
resource-scoped).
Validates a template body or URL and reports its parameters, capabilities,
and declaration errors — e.g. a platform service that lints user-submitted
templates before deploying them. Provide the implementation with
Effect.provide(AWS.CloudFormation.ValidateTemplateHttp).
ValidateTemplate: Validating Templates
Section titled “ValidateTemplate: Validating Templates”const validateTemplate = yield* AWS.CloudFormation.ValidateTemplate();
const { Parameters, Capabilities } = yield* validateTemplate({ TemplateBody: templateJson,});