Successfully reported this slideshow.

Microservices and serverless in python projects

7

Share

Microservices and Serverless in
Python projects
José Manuel Ortega
Europython 2018
@jmortegac
v 0.5

YouTube videos are no longer supported on SlideShare

View original on YouTube

Agenda
•Microservices in python
•Introducing Serverless and Function as a Service
•Python frameworks for AWS
•AWS Lambda f...
Upcoming SlideShare
AWS and Serverless Computing
AWS and Serverless Computing
Loading in …3
×
1 of 60
1 of 60

More Related Content

More from Jose Manuel Ortega Candel

Related Books

Free with a 14 day trial from Scribd

See all

Related Audiobooks

Free with a 14 day trial from Scribd

See all

Microservices and serverless in python projects

  1. 1. Microservices and Serverless in Python projects José Manuel Ortega Europython 2018 @jmortegac v 0.5
  2. 2. Agenda •Microservices in python •Introducing Serverless and Function as a Service •Python frameworks for AWS •AWS Lambda functions with zappa and chalice •Deploy AWS lambda functions from aws console 2Microservices and Serverless in Python projects
  3. 3. Microservices vs Serverless 3Microservices and Serverless in Python projects
  4. 4. Microservices 4Microservices and Serverless in Python projects
  5. 5. Asynchronous calls with asyncio and aiohttp 5Microservices and Serverless in Python projects
  6. 6. REST API Development 6Microservices and Serverless in Python projects
  7. 7. Performance 7Microservices and Serverless in Python projects 8% less memory 6% faster response times
  8. 8. Microservices with graphql 8Microservices and Serverless in Python projects
  9. 9. 9Microservices and Serverless in Python projects
  10. 10. 10Microservices and Serverless in Python projects
  11. 11. 11Microservices and Serverless in Python projects
  12. 12. 12Microservices and Serverless in Python projects
  13. 13. 13Microservices and Serverless in Python projects SERVER
  14. 14. 14Microservices and Serverless in Python projects CLIENT
  15. 15. Microservices benefits •Separation of concerns •Services are decoupled from each other •Managing smaller projects •More scaling and deployment options 15Microservices and Serverless in Python projects
  16. 16. 16Microservices and Serverless in Python projects Serverless
  17. 17. Serverless architecture •FaaS - Function as a Service •Fully managed computing • Provisioning • Scalability • Monitoring • Logging •Deploy your code •Pay only for actual usage 17Microservices and Serverless in Python projects
  18. 18. Serverless architecture 18Microservices and Serverless in Python projects
  19. 19. Serverless uses cases ➢ REST API • Stateless services and microservices • Suitable for Chat bots ➢ Events • File processing (S3 event) & Data ingestion • Data/Stream processing • Incidents handling (CloudWatch event log) • IoT ➢ Scheduled tasks • Monitoring, load testing • Periodical jobs 19Microservices and Serverless in Python projects
  20. 20. 20Microservices and Serverless in Python projects
  21. 21. Serverless benefits •No server management •Automatic scaling and load balancing •Lower infrastructure costs •Flexibility and high availability •Infrastructure managed by service provider 21Microservices and Serverless in Python projects
  22. 22. Serverless drawbacks • The tools around the deployment automation of serverless functions are still in development. •There is no control over containers when the execution environments are created or destroyed •Debugging, Deploying and monitoring 22Microservices and Serverless in Python projects
  23. 23. Cloud providers •AWS •Microsoft Azure •Cloud platform •OpenWhisk(OS) •Kubeless(OS) 23Microservices and Serverless in Python projects
  24. 24. Aws lambda 24Microservices and Serverless in Python projects
  25. 25. 25Microservices and Serverless in Python projects
  26. 26. Aws lambda functions 26Microservices and Serverless in Python projects
  27. 27. Aws lambda functions 27Microservices and Serverless in Python projects
  28. 28. Create lambda function with awscli 28Microservices and Serverless in Python projects $ aws lambda create-function --region eu-west-1 --function-name MyHandler --zip-file fileb://handler.zip --role arn:aws:iam::XXX:role/MyLambdaRole --vpc-config SubnetIds=XXX,SecurityGroupIds=XXX --handler handler.handler --runtime python3.6 --profile personal --timeout 10 --memory-size 512
  29. 29. 29Microservices and Serverless in Python projects
  30. 30. 30Microservices and Serverless in Python projects
  31. 31. Frameworks 31Microservices and Serverless in Python projects python-λ
  32. 32. 32Microservices and Serverless in Python projects
  33. 33. 33Microservices and Serverless in Python projects
  34. 34. Zappa architecture 34Microservices and Serverless in Python projects
  35. 35. Zappa 35Microservices and Serverless in Python projects
  36. 36. 36Microservices and Serverless in Python projects
  37. 37. 37Microservices and Serverless in Python projects
  38. 38. 38Microservices and Serverless in Python projects
  39. 39. 39Microservices and Serverless in Python projects # zappa_settings.json { "dev": { "aws_region": "us-east-1", "django_settings": "hello.settings", "profile_name": "default", "project_name": "hello", "runtime": "python3.6", "s3_bucket": "zappa-huyg6op0s" } }
  40. 40. Zappa deploy 40Microservices and Serverless in Python projects $ zappa deploy <env> •Zips code and dependencies •Create AWS Lambda and deploys the zip •Creates endpoint on API Gateway and links to AWS Lambda
  41. 41. Zappa deploy 41Microservices and Serverless in Python projects
  42. 42. Zappa 42Microservices and Serverless in Python projects
  43. 43. Zappa Asynchronous Task 43Microservices and Serverless in Python projects
  44. 44. Chalice 44Microservices and Serverless in Python projects •Python Serverless Microframework for AWS •Each endpoint is a separate function
  45. 45. Chalice 45Microservices and Serverless in Python projects
  46. 46. Chalice 46Microservices and Serverless in Python projects
  47. 47. Chalice example 47Microservices and Serverless in Python projects
  48. 48. Chalice methods 48Microservices and Serverless in Python projects Resource HTTP Verb AWS Lambda /talks GET get_talks /talk POST add_new_talk /talks/{ID} PUT update_talk /talks/{ID} DELETE delete_talk
  49. 49. Chalice methods 49Microservices and Serverless in Python projects
  50. 50. Chalice options 50Microservices and Serverless in Python projects
  51. 51. Chalice deploy 51Microservices and Serverless in Python projects Updating IAM policy. Updating lambda function... Regen deployment package... Sending changes to lambda. API Gateway rest API already found. Deploying to: dev
  52. 52. 52Microservices and Serverless in Python projects
  53. 53. https://github.com/lambci/docker-lambda 53Microservices and Serverless in Python projects
  54. 54. http://serverlesscalc.com/ 54Microservices and Serverless in Python projects
  55. 55. 55Microservices and Serverless in Python projects
  56. 56. https://github.com/serverless/examples 56Microservices and Serverless in Python projects
  57. 57. References 57Microservices and Serverless in Python projects •https://aws.amazon.com/blogs/compute/microservic es-without-the-servers •https://github.com/Miserlou/Zappa •https://github.com/pmuens/awesome-serverless •https://github.com/aws/chalice •https://chalice.readthedocs.io/en/latest
  58. 58. 58Microservices and Serverless in Python projects Serverless architecture is the next generation of cloud evolution
  59. 59. Thank you! José Manuel Ortega jmortega.github.io

×