Adding a python API handler with serverless

Create an AWS Lambda function with Python3 and integrate with S3? Simple if you know how (though getting there is a bitch, I bet Amazon does this on purpose as a way to trick developers in on their certification-ride). I found how, copy-paste below.

Note: These are set up with serverless, which is an awesome tool. If you’re a Cloudformation/Terraform-user, I bet you’ll figure it out from the .yml-file.

Simple hello world response

https://gist.github.com/tomfa/22f2a1f7567377d6fbfcd5ce5106642d

Simple function that will write to S3

https://gist.github.com/tomfa/7bb519a34262353087a83712539eb6b0

Simple function that will accept .csv and save .json to S3

This one is more tricky! We can add an API-Gateway as an S3 proxy, and fire a trigger lambda after the upload. That is probably also the advisable thing to do. If you persist in going in the wrong direction on this, you can end up solving it like this: