last day (23 days later) » 

5:48 AM
1
A: sns unable to trigger lambda when created using cloudformation

John RotensteinIt appears that you are wanting to trigger an AWS Lambda function when the CloudFormation stack deploys. You can do this with an AWS Lambda-backed Custom Resource. The template should include: The Lambda function A Custom:: entry to trigger your Lambda function The Lambda function will need...

 
Sid
It's failing, and going into rollback. Are you saying the lambda function needs to have code to send response to cloudformation stack, how do we do it?
 
Sounds like you are not (successfully) signalling back from the Lambda function. Use the cfn-response module to perform the signal.
 
Sid
Thanks John, I could see cfnresponse sends physicalresourceId as well, is there a way I can export in output of cloudformation template for further use, I couldn't find any code for that. Also when you delete a stack, it deletes the custom resource and lambda, how do we delete resources created by lambda?
 
The physicalResourceId is shown as optional, so you probably don't need it. As for deleting, what do you mean by "resources created by Lambda"? If you created resources through API calls from your Lambda code, then CloudFormation would have no knowledge of such resources, so it would not be able to delete them.
 
Sid
Code which i updated in my question section is giving me weird errors like index module not found, cfnresponse not found.
 
5:48 AM
In looking at a similar solution, try using context.log_stream_name as the physicalResourceId. Or, frankly, try leaving out physicalResourceId altogether since it is listed as optional on the API call.
 
Sid
I can try that, However the error I think is not related to that cfnresponse.send, this is the last error in cloudwatch.
Unable to import module 'index': No module named 'cfnresponse'
 
6:24 AM
I'll see if I can reproduce the situation. I previously only used stelligent to make the callback, but had problems using that with Python 3.
Here's an example I found of somebody else using cfnresponse: gist.github.com/dasgoll/611220330a187c6efccbcb4180603794
Which version of Python have you selected?
You aren't defining responseData, so that could be a problem. Based on that example, try responseData = {}
 
Sid
6:45 AM
Ok, let me try that, However this weird error that it's not able to find index module, its the script file name in which there is handler


Unable to import module 'index': No module named 'cfnresponse'
 

  last day (23 days later) »