I've recently spun up some lambda-docker containers for a CadHub feature. Infinitely scaling lamdas where I can control the environment sounds perfect right! The devil is always in the details and here are some sticking points that I hit.
AWS needs some of their own magic on the docker images in order for them to spin them up quickly. If you build on top of one of their provided images this should be handled for you. Since I'm a frontend developer without tonnes of linux experience I found it difficult to figure out how to install the OS level packages I needed on these specialised images. I instead ended up using something more standard and easy to work with (Ubuntu) and then install Amazon's utilities on top. I found this to be easier, if you're looking to do this yourself these lines in my docker file and this `entrypoint.sh` might be of use.
Using the Serverless framework, adding CORS to an endpoint should be simple and one line of config. Unfortunately, this seems more catered to normal lamdas, and found it didn't work for my docker-lamdas and ended up making options endpoints to roll my own CORS for browser-preflight.
If you want to return binary types from your lambda you need to add API Gateway settings to allow this, but what you actually return from the lamdba is base64 encoded, but another quirk is that the input into the lambda is also base64 encoded and as far as I know this can't be turned off. The biggest drawback I found to this workflow is how much of a pain it is to test the lambda locally since you can't send it a dumby payload without first encoding it. Another thing to be aware of is that the API Gateway has a response limit of 10mb so it might be worth skipping the binary types altogether and instead dump the asset in S3 and return a signed S3 url.
These are all manageable problems, the worst part about it is how much they can stifle momentum when you hit unintuitive issues. Because I was trying to use node on these containers, I found most node resources to be focused on node-lamdas, not docker, so community blog posts were lacking. Would love to hear issues other front-end developers hit trying to use AWS and serverless, you can @ me.