Do that Python thing - without the servers!
Add a watermark to a picture that was uploaded in your app
Created by Rich Jones (github/miserlou)
Serverless Python Web Services - Powered by AWS Lambda and API Gateway
*Web Server Gateway Interface
The name that cloud providers give to Microservices
The name that cloud providers give to Microservices
Think Functions!
Cloud Provider | Service Name |
---|---|
AWS | Lambda |
Microsoft Azure | Functions |
Cloud Functions |
Handler function
def my_handler(event, context):
return "response!"
Converts HTML into Lambda event/context objects
Handler function
def my_handler(event, context):
return "response!"
PEP 333 (WSGI) !!!
def wsgi_function(environ, start_response):
return "response!"
Converts lambda event/context into WSGI
Supports all python WSGI frameworks
Can create all the AWS permissions/roles/buckets for you
zappa init
Understand what this step does
Manage your deployments
zappa deploy
zappa update
Understand what is going on inside your app
zappa status
zappa tail
Configure Events
"events": [
{ // Recurring events
"function": "your_module.your_recurring_function", // The function to execute
"expression": "rate(1 minute)" // When to execute it (in cron or rate format)
},
{ // AWS Reactive events
"function": "your_module.your_reactive_function", // The function to execute
"event_source": {
"arn": "arn:aws:s3:::my-bucket", // The ARN of this event source
"events": [
"s3:ObjectCreated:*" // The specific event to execute in response to.
]
}
}
]
Environment variables in zappa config, S3 or KMS
Certificate management
Django management commands
Leverages writing python apps on AWS Lambda
AWS is cheap - specially for small apps
Default options are permissive security wise
Serverless = Stateless
you still need to store your data somewhere