python in the serverless era

35
Python In The Serverless Era Benny Bauer Software Architect, Autodesk [email protected] @benikbauer

Upload: vokien

Post on 13-Feb-2017

224 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Python In The Serverless Era

Python In The Serverless Era

Benny BauerSoftware Architect, Autodesk

[email protected]

@benikbauer

Page 2: Python In The Serverless Era

▪ Hello

▪ Cloud Evolution

▪ Serverless Architecture

▪ Ecosystem

Agenda

Page 3: Python In The Serverless Era

Hello

Page 4: Python In The Serverless Era

Hello

Page 5: Python In The Serverless Era

AutoCAD 360

Page 6: Python In The Serverless Era

AutoCAD 360 Backend

Page 7: Python In The Serverless Era

Cloud Evolution

Page 8: Python In The Serverless Era

It’s Evolution Baby!

Icons made by freepik from www.flaticon.com

Page 9: Python In The Serverless Era

▪ Hosting▪ Data access▪ Authentication▪ Notifications▪ Monitoring▪ Analytics

Backend as a Service

Page 10: Python In The Serverless Era

Serverless Architecture

Page 11: Python In The Serverless Era

Introducing Serverless

Page 12: Python In The Serverless Era

▪ Fully managed compute▪ Provisioning, patching▪ Scalability▪ Monitoring▪ Logging▪ No ops

▪ Just deploy your code▪ Pay only for actual usage ==

Full utilisation!

Serverless Architecture

Page 13: Python In The Serverless Era

AWS Lambda - How it works

origin: https://aws.amazon.com/lambda/

Page 14: Python In The Serverless Era

▪ 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

▪ Stateless

▪ Autoscaled according to demand (events or requests)

AWS Lambda Characteristics

Page 16: Python In The Serverless Era

▪ 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

Code should be:

▪ Small

▪ Short-lived

▪ Stateless

The Required Mindset

Page 18: Python In The Serverless Era

Ecosystem

Page 19: Python In The Serverless Era

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

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

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

$ sls project create

Page 23: Python In The Serverless Era

$ sls function create

Page 24: Python In The Serverless Era

▪ 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

$ sls dash deploy

Page 26: Python In The Serverless Era

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

Zappa Architecture

Page 28: Python In The Serverless Era

Zappa example

Page 29: Python In The Serverless Era

Zappa example

Page 30: Python In The Serverless Era

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

Serverless architecture is the next generationof cloud evolution

Takeaways

Page 32: Python In The Serverless Era

The Serverless ecosystem is on the rise,many interesting opportunities for

the Python community to contribute!

Takeaways

Page 33: Python In The Serverless Era

▪ 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

Questions?

Page 35: Python In The Serverless Era

Thank You!