Pythonic Microservices on AWS Lambda
Then let Psychic Disco be your principal delegate for publicly displaying your work!
By leveraging the pioneering domains of AWS Lambda and the Serverless Web, Psychic Disco allows even plebian dummies like you and I to scale the platforms of our dreams on the cheap.
Install like so:
pip install psychic_disco
- All your microservices live in python modules
- All your entrypoints are decorated with @lambda_entry_point
Make a new entrypoint:
@lambda_entry_point def handler(event, context): # important code here
Making a new api method automatically registers the entrypoint:
@api_method("POST", "/cereal"): def create_cereal(event, context): # cereal creation logic here
Definitions for your API methods are available in psychic_disco.Api.
Do this thing:
Or, if your code lives elsewhere:
psychic_disco --repo path/to/st/elsewhere discover_entrypoints
Do this thing:
That will make a virtualenv, install your dependencies, and zip it all up for you. This assumes that you have psychic_disco.config.default_s3_bucket defined in your psychic_disco_config.py
Once a deployment package has been uploaded to Amazon S3, you can install the lambda functions you defined like so:
This assumes that you have psychic_disco.config.default_iam_role defined in your psychic_disco_config.py
You can see what has already been configured on AWS by running:
psychic_disoc show_installed_routes <api-name>
Which will output something like: