Download - Python In The Serverless Era
![Page 1: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/1.jpg)
Python In The Serverless Era
Benny BauerSoftware Architect, Autodesk
@benikbauer
![Page 2: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/2.jpg)
▪ Hello
▪ Cloud Evolution
▪ Serverless Architecture
▪ Ecosystem
Agenda
![Page 3: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/3.jpg)
Hello
![Page 4: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/4.jpg)
Hello
![Page 5: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/5.jpg)
AutoCAD 360
![Page 6: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/6.jpg)
AutoCAD 360 Backend
![Page 7: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/7.jpg)
Cloud Evolution
![Page 9: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/9.jpg)
▪ Hosting▪ Data access▪ Authentication▪ Notifications▪ Monitoring▪ Analytics
Backend as a Service
![Page 10: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/10.jpg)
Serverless Architecture
![Page 11: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/11.jpg)
Introducing Serverless
![Page 12: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/12.jpg)
▪ Fully managed compute▪ Provisioning, patching▪ Scalability▪ Monitoring▪ Logging▪ No ops
▪ Just deploy your code▪ Pay only for actual usage ==
Full utilisation!
Serverless Architecture
![Page 14: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/14.jpg)
▪ REST API▪ Stateless services
▪ Suitable for Slack apps (though not bots)
▪ Events▪ File processing (S3 event) & Data ingestion (Kinesis event)
▪ Incidents handling (CloudWatch event)
▪ IoT
▪ Scheduled tasks▪ Monitoring, sanity tests, load testing
▪ Periodical jobs
Use cases
![Page 15: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/15.jpg)
▪ Stateless
▪ Autoscaled according to demand (events or requests)
AWS Lambda Characteristics
![Page 16: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/16.jpg)
▪ Need to keep it warm
▪ Convenience can lead to vendor lock-in
▪ Languages: Python 2.7, Node.js, Java 8
▪ Execution time is limited to 5 min
▪ Concurrent execution is limited to 100*
▪ Various payload and disk size limits
▪ Not in all AWS regions
▪ No SSH (which is good!)
AWS Lambda Limitations
![Page 17: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/17.jpg)
Code should be:
▪ Small
▪ Short-lived
▪ Stateless
The Required Mindset
![Page 18: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/18.jpg)
Ecosystem
![Page 19: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/19.jpg)
AWS Lambda & API Gateway are nice, but...
▪ Configuration headache▪ IAM roles
▪ API Gateway
▪ Deployment headache▪ Packaging
▪ Uploading
▪ Rollback
![Page 20: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/20.jpg)
Serverless Framework
Application framework for building applications exclusively on AWS Lambda and API Gateway
Serverless
origin: https://github.com/serverless/serverless
![Page 21: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/21.jpg)
Serverless Framework
▪ Wraps AWS Lambda, API Gateway and IAM
▪ Manages deployments
▪ CLI
▪ Modular, functions can be easily shared
▪ Extensible via plugins
▪ Thriving community
▪ Node.js - posterboy, Python - foster child
![Page 22: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/22.jpg)
$ sls project create
![Page 23: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/23.jpg)
$ sls function create
![Page 24: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/24.jpg)
▪ handler.py▪ Entry point to your implementation
▪ s-function.json▪ Endpoints configuration▪ Events configuration▪ Env vars definition▪ Lambda configuration (runtime, timeout, size, etc.)
# implement
functions
|__function1
|__event.json
|__handler.py
|__s-function.json
![Page 25: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/25.jpg)
$ sls dash deploy
![Page 26: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/26.jpg)
Zappa
Python WSGI applications deployment on AWS Lambda + API Gateway.
Rich JonesMiserlou
origin: https://github.com/Miserlou/Zappa
![Page 27: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/27.jpg)
Zappa Architecture
![Page 28: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/28.jpg)
Zappa example
![Page 29: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/29.jpg)
Zappa example
![Page 30: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/30.jpg)
Zappa - How it works
$ zappa deploy <env>
1. Zips code and dependencies
2. Create AWS Lambda and deploys the zip
3. Creates endpoint on API Gateway and ties to AWS Lambda
![Page 31: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/31.jpg)
Serverless architecture is the next generationof cloud evolution
Takeaways
![Page 32: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/32.jpg)
The Serverless ecosystem is on the rise,many interesting opportunities for
the Python community to contribute!
Takeaways
![Page 33: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/33.jpg)
▪ awesome-serverless▪ https://github.com/Miserlou/Zappa▪ Serverless Framework talk (aka JAWS) on AWS re:invent
https://youtu.be/D_U6luQ6I90
References
![Page 34: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/34.jpg)
Questions?
![Page 35: Python In The Serverless Era](https://reader036.vdocuments.us/reader036/viewer/2022062504/58a1a4c81a28abcf2d8bed15/html5/thumbnails/35.jpg)
Thank You!