Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Serverless PHP Application

Serverless PHP Application

Avatar for Petra Barus

Petra Barus

July 16, 2019
Tweet

More Decks by Petra Barus

Other Decks in Technology

Transcript

  1. Hello! Petra Novandi Barus Country CTO, 99.co Indonesia CTO, UrbanIndo.com

    AWS User Group leader PHP User Group leader Proud AWS User since 2012 3 petrabarus
  2. AWS Adoption in UrbanIndo/99.co 2011 2013 2014 2012 2015 2017

    2018 2016 First migration to AWS EC2 S3 RDS/MySQL Beanstalk Route53 Single Node in VPS OpsWorks Elasticache Cloudwatch Autoscaling Lambda Elasticsearch API Gateway Athena Data Pipeline EMR SQS SNS DynamoDB CloudFront ECS Redshift Step Functions
  3. PHP is still relevant ◇ Easy to use ◇ A

    lot of mature frameworks to use ◇ Have very large community ◇ PHP is still evolving and actively developed ◇ Catching up with modern programming features
  4. 7

  5. Common conventional PHP Application ◇ First time language for most

    programmers ◇ Most common use for first version of products ■ Still favorite for most startup to achieve fast iteration ◇ Single node web server, not scalable, not maintainable ◇ Tends to become large monolithic ■ At this point, it will be very hard to scale
  6. Putting PHP to Cloud ◇ PHP still have limitations ◇

    A good product should combine a lot of tools. The right tool for the right job. ◇ Keep product scalably working large customers while rebuilding the next 1000x versions ◇ This is where putting PHP application to cloud makes sense ■ Scalable and Pay as you go
  7. What and Why Serverless? ◇ No server to maintain ◇

    Scalable ◇ Pay as you go ◇ Secure 11
  8. Lambda Runtime and Lambda Layer ◇ Initially Lambda only supports

    Java, Go, Javascript, and Python. ◇ Then comes Lambda Runtime & Lambda Layer!
  9. Lambda Runtime and Lambda Layer ◇ Lambda Runtime ■ Enable

    to run all programming languages ◇ Lambda Layer ■ Enable to package common shared code and library to be reused in lambda functions
  10. PHP on AWS Lambda ◇ Utilises Lambda Runtime ◇ Can

    use PHP Lambda Layer from stackery https://github.com/stackery/php-lambda-layer ◇ Also available in other serverless framework, e.g. Serverless ◇ Warning: ■ Most PHP framework e.g. Laravel are using local file for caching, session management, and logging. ■ Need to move to outside service, e.g. Caching using Elasticcache, Session using DynamoDb, and Logging using Cloudwatch
  11. AWS Fargate ◇ Container Service by AWS ◇ No EC2

    server to maintain ◇ Pay as you go ◇ Integrated with AWS services e.g. Service Discovery, Cloudwatch, Elastic Loadbalancing, etc
  12. AWS Lambda or AWS Fargate? AWS Lambda ◇ Short lived

    code ◇ Event-based AWS resource integration ◇ Small services AWS Fargate ◇ Long running code ◇ Generic business logic ◇ Existing large codebase/service ◇ Larger and more customized library/dependencies