Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PHP as a Service

183 views

Published on

Function as a service (FaaS) is a way to keep the focus on business delivery. Basically, we don't know how our code will run, infrastructure. Here we now how aws lambda works and how to run PHP into AWS Lambda

Published in: Technology
  • Be the first to comment

  • Be the first to like this

PHP as a Service

  1. 1. PHP as a Service Paulo Victor Gomes @_pvgomes CTO at Mundo Verde and Natue
  2. 2. XaaS ? (IaaS/SaaS/PaaS/FaaS/CaaS)
  3. 3. Function as a Service - FaaS/Serverless Software developers can leverage this to deploy an individual “function”, action, or piece of business logic. They are expected to start within milliseconds and process individual requests and then the process ends. Principles of FaaS - Complete abstraction of servers away from the developer - Billing based on consumption and executions, not server instance sizes - Services that are event-driven and instantaneously scalable
  4. 4. Serverless Infrastructure Providers
  5. 5. A simple AWS Lambda https://github.com/pvgomes/slack-lambda
  6. 6. A simple AWS Lambda
  7. 7. A simple AWS Lambda
  8. 8. A simple AWS Lambda - deploy Package the code Upload with aws cli
  9. 9. Make your life easier https://serverless.com/
  10. 10. Serverless + AWS Lambda
  11. 11. Serverless configuration
  12. 12. Serverless + AWS Lambda
  13. 13. Serverless + AWS Lambda
  14. 14. What about PHP?
  15. 15. PHP as a Service - FaaS 1 request = 1 process
  16. 16. PHP as a Service - FaaS PHP is faas-ready
  17. 17. What about AWS Lambda and PHP? AWS lambda does not support PHP
  18. 18. NodeJs PHP Handler
  19. 19. Is that ok for you?
  20. 20. AWS Lambda Layers
  21. 21. Install AWS SAM AWS Serverless Application Model https://aws.amazon.com/serverless/sam/
  22. 22. Get latest version of the PHP layer
  23. 23. Create cloudformation template
  24. 24. Add the following Lambda Layer
  25. 25. Create index.php
  26. 26. Create AWS S3 deployment bucket
  27. 27. Create Cloudformation stack
  28. 28. Deploy Cloudformation stack
  29. 29. Ok, but...
  30. 30. PHP community never sleep
  31. 31. Bref.sh
  32. 32. Bref Installation Install using composer Init a sample function
  33. 33. Bref Sample
  34. 34. Bref Sample
  35. 35. Bref Sample - template.yaml
  36. 36. Bref Sample - template.yaml
  37. 37. Bref Sample - index.php
  38. 38. Lambda run locally
  39. 39. Bref run locally
  40. 40. SAM uses docker The docker container runs and die
  41. 41. SAM uses docker type docker ps when you request the url to check it
  42. 42. Bref Deployment Generate the stack configuration
  43. 43. Bref Deployment Deploy the generated stack
  44. 44. Our lambda is deployed
  45. 45. Our lambda is deployed
  46. 46. API Gateway URL / test me https://igodztg0s8.execute-api.us-east-1.amazonaws.com/Prod
  47. 47. Bref with Laravel and Symfony https://bref.sh/docs/frameworks/laravel.html https://bref.sh/docs/frameworks/symfony.html
  48. 48. Obrigado! https://joind.in/event/php-experience-2019/php-as-a-service Thank you! @_pvgomes Joind.in
  49. 49. Obrigado! References https://stackoverflow.com/questions/44110427/does-aws-lambda-supports-php/55320824#55320824 https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html https://www.youtube.com/watch?v=gn8BOnLlBGw&t=35s https://martinfowler.com/articles/serverless.html https://www.stackery.io/blog/aws-lambda-php/ https://bref.sh/

×