Skip to content

Resource

Source: src/AWS/CloudControl/Resource.ts

A generic AWS resource managed through the Cloud Control API — the escape hatch that covers hundreds of CloudFormation resource types with a single Alchemy resource.

Provide a CloudFormation typeName and a desiredState object; the provider drives Cloud Control’s asynchronous create/update/delete and polls the request token (bounded) until it reaches SUCCESS, surfacing a FAILED operation as a typed error rather than hanging. Updates are expressed as an RFC 6902 JSON Patch computed over the keys you specify.

SSM Parameter

const param = yield* CloudControl.Resource("Greeting", {
typeName: "AWS::SSM::Parameter",
desiredState: {
Name: "/app/greeting",
Type: "String",
Value: "hello",
},
});
// param.identifier -> "/app/greeting"
// param.properties.Value -> "hello"

SNS Topic

const topic = yield* CloudControl.Resource("Alerts", {
typeName: "AWS::SNS::Topic",
desiredState: { TopicName: "alerts", DisplayName: "Alerts" },
});
// topic.identifier -> "arn:aws:sns:us-west-2:...:alerts"