Forked from unacceptable/lambda_handler_cloudformation.py
Created
October 2, 2018 03:49
-
-
Save vvalorous/76dd345aebc9aebb9f17ea076be3bf9b to your computer and use it in GitHub Desktop.
This is a lambda handler that I am saving for the next time that I choose to execute lambda from a CloudFormation script.
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
def lambda_handler(event, context): | |
try: | |
logger.info(json.dumps(event,indent=4)) | |
main(event, context) | |
responseStatus = 'SUCCESS' | |
responseData = {} | |
except Exception as msg: | |
logger.error(msg) | |
responseStatus = 'FAILED' | |
responseData = {'error':msg} | |
logger.info( | |
'Sending CloudFormation Response. ' + | |
' Status: ' + responseStatus + ', ' + | |
' Status JSON: ' + str(responseData) | |
) | |
cfnresponse.send( | |
event, | |
context, | |
responseStatus, | |
responseData | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment