Skip to content

Instantly share code, notes, and snippets.

@samg
Last active January 31, 2024 23:34
Show Gist options
  • Save samg/aae5cdde497d7dc9c662ba1a81978dd5 to your computer and use it in GitHub Desktop.
Save samg/aae5cdde497d7dc9c662ba1a81978dd5 to your computer and use it in GitHub Desktop.
example logging curl command for CFN custom resources
module.exports = async message => {
/* Custom resources have timeouts on the order of hours. If a resource fails
* to deploy, we can look at the logs to at least be able to manually fail the
* resource action so we can try again quickly. */
const failureResponse = {
Status: 'FAILED',
Reason: 'Manually cancelled',
PhysicalResourceId: message.PhysicalResourceId || 'resource',
StackId: message.StackId,
RequestId: message.RequestId,
LogicalResourceId: message.LogicalResourceId
};
console.log('To forcibly fail this provision, execute this cURL command:');
console.log(`curl -X PUT '${message.ResponseURL}' -H 'Content-Type:' -d '${JSON.stringify(failureResponse)}'`);
// more code goes here...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment