Created
February 7, 2019 07:19
-
-
Save bwinant/ffc669a9b65035c69636dd5536e9c3cb to your computer and use it in GitHub Desktop.
CloudFormation CustomResource lambda response
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sendResponse = async (event, context, status, data = {}) => { | |
const response = { | |
Status: status, | |
RequestId: event.RequestId, | |
LogicalResourceId: event.LogicalResourceId, | |
StackId: event.StackId, | |
PhysicalResourceId: context.functionName, | |
Data: data | |
}; | |
try { | |
console.log(`Sending ${JSON.stringify(response)}`); | |
const result = await axios.put(event.ResponseURL, response); | |
console.log(`Result is ${result.status}`); | |
} | |
catch (err) { | |
// TODO: if this happens, then what? | |
console.log(err); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment