Well I’ve had a sort of successful attempt with some caveats. I have the following;
A Lambda that runs a Dash app to pull some data on the performance of Lambda functions on the account (Invocations, Errors etc) for the previous 24hrs. The Lambda is deployed with Serverless using the Serverless WSGI plugin. The entry point of the Lambda via the WSGI handler is app.server (the flask server) so I’m following the same approach you’d use to deploy a Flask app on Lambda.
This lambda is accessed/triggered by an API Gateway. Other than the initial data pull taking ~20s (I have ways to speed that up) it all seems to work reasonably well. I’ve tried where possible to do as much of the data work outside of the “app” so it runs once per Lambda instantiation not invocation. The only problem I currently have now is it only works with the raw API Gateway URL and not when I sanitise it with a nice Route53 URL. I believe this is due to a conflict between the actual URL have a Dev/Test/Prod suffix (which API Gateway mandates in some way) as I’m seeing 403 errors on some pieces of the app like the Dash renderers.
For now, the ugly URL will do, and I’m trying to make a nice clean example I can pop on GitHub. So watch this space and as soon as I get time I can share some code.