Published Dec 25, 2020

In this post we will learn how to package a Containerized Flask app to use w/ AWS Lambda. Skip to code

AWS Lambda Containerized Flask Application

This is example on how to create flask app container to use w/ AWS Lambda.

Contents
· File Tree
· Files Review
Dockerfile
api.init.py
.serverless-wsgi
entry.sh
requirements.txt
wsgi.py
Final Step
· Code
References

File Tree

This example assumes that you have initialized your dir like below.

.
├── Dockerfile
├── api
│ └── __init__.py
├── .serverless-wsgi
├── entry.sh
├── requirements.txt
└── wsgi.py

Files Review

In this section we’ll go thru each…


In this post we will learn how to create AWS Websocket API Gateway, and how to secure and optimize it.

Things to note:

  • AWS Websocket Gateway cannot be deployed as private gateway like REST API.
  • $connect and $disconnect are pre-define routes.
  • All authorization need to happen on $connect event.
  • We will set API Key to manage the access from client, but this key will be visible and cannot be use as authorization.

Overview diagram:

We’ll create a sample echo app to see how websocket messaging works. We’ll start by creating three python lambdas.

sample-echo-app-connect:

def authorized(auth_header: str) -> bool…

Ritul Patel

Software Engineer with passion to learn new tech!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store