due to cfn not supporting everything, I need to build a couple of things such as interface vpc endpoints using the sdk and lambda custom resources. I have the lambda function ready and when I run it it works, however when I deploy this using cfn with the custom resource in place, it errors out with
Invalid Response object: Value of property Data must be an object
this then goes around for 3 yes 3 hours trying to delete something that does not exist. Any ideas why I’m getting this error? the resource is as follows
it was “working” initially however I’ve not had the cfnresponse in the lambda function so it was stuck on “creation in progress” for about an hour, followed by 3h of deleting things ;/ which brings me to my second question, how can I get it to delete what has been created by a custom resource? I’ve already given the lambda role delete permissions
When the lambda function triggers, there is an object in the event json called RequestType. That will be Create, Update or Delete. That is where you would code in what the lambda would do when a delete event is triggered.
Also, wrap everything in the Lambda function in a try/catch and in the finally block, always return a response back to the CF template. This will stop the stack from being stuck for an hour.