Skip to content

Instantly share code, notes, and snippets.

@leegilmorecode
Created July 31, 2022 05:42
Show Gist options
  • Save leegilmorecode/946eb385c503adddda4b3fe672355754 to your computer and use it in GitHub Desktop.
Save leegilmorecode/946eb385c503adddda4b3fe672355754 to your computer and use it in GitHub Desktop.
Custom Resource Example with the AWS CDK
// this custom resource will create our postgres table on deploy if it doesn't exist
const provider: cr.Provider = new cr.Provider(
this,
"CreateOnlineOrdersTableCustomResource",
{
onEventHandler: createTableHandler, // this lambda will be called on cfn deploy
logRetention: logs.RetentionDays.ONE_DAY,
providerFunctionName: "create-online-table-custom-resource",
}
);
new CustomResource(this, "CustomResource", {
serviceToken: provider.serviceToken,
properties: {
...environment,
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment