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

Scaling Laravel Application from one EC2 instan...

Set Kyar Wa Lar
September 02, 2023
140

Scaling Laravel Application from one EC2 instance to ECS

lara.camp မှာ ကျနော်ပြောသွားတဲ့ Scaling Laravel Application from one EC2 instance to ECS/EKS ဆိုတဲ့ talk ရဲ့ side ဘဲဖြစ်ပါတယ်။

Set Kyar Wa Lar

September 02, 2023
Tweet

Transcript

  1. From a single EC2 instance to ASG, ECS, EKS Other

    useful information that you might need to note by Set Kyar Wa Lar Scaling Laravel Application on AWS
  2. Set Kyar Wa Lar Backend Developer - Affyn (Node.js) MyanmarDevJobs.com

    DevOps Engineer Backend Engineer (Laravel) ABOUT ME
  3. I am not familiar with AWS You can still apply

    the idea! I want to learn AWS, any suggestion? - Learn AWS Networking first - Try learning Associate Certificate A few notes before we start
  4. Single EC2 Instance Topics 01 Multiple EC2 instances 02 AWS

    Manage ALB, ASG, Opensearch, RDS, S3 03 AWS ECS/EKS 04
  5. Pro - Easy to maintain Con - Hard to scale

    horizontally Single EC2 Instance
  6. Let’s move on to Multiple EC2 Instances - Application got

    more traffic - Can’t handle with one single EC2 instances Why?
  7. Things to notes • LB can be bottlenet? (HAProxy) •

    How are you planning to deploy? • How are you planning to manage .env and logs? • How to scale out and in? (manually?) • How about the software updates to EC2? Laravel Proxy - https:/ /laravel.com/docs/10.x/requests#configuri ng-trusted-proxies - Redirects - Login issues because Multiple EC2 Instances
  8. Pro - Able to scale horizontally Con - Scaling in/out

    are manual - Tedious to update something like (PHP Version) Multiple EC2 Instances
  9. Let’s move on to Auto Scaling Group (ASG) Why? -

    We don’t want to scale in and out manually, we want something that can automate - We want to take advantage of cloud manage services instead of managing everything How to use ASG? - Choose AMI (Ubuntu) and install softwares that you want to use (Golden Image) - Set min and max instances in specific conditions (when CPU% reach, Memory% reach, In this date)
  10. Pro - Able to auto scale horizontally Con - You

    need to manage Golden Image Auto Scaling Group (ASG)
  11. Let’s move on to Elastic Container Service (ECS) Why? -

    Serverless (Fargate), no need to manage servers - Containerized How to use ECS? - Dockerize your application - Create task definition (port mapping, cpu, memory allocation)
  12. - Prepare your application to be in stateless (EC2, ASG,

    ECS, EKS) - You need to know how underlying stuff work. Like Eloquent ORM. - If your application have heavy search functionality, better explore options like ES - EKS - Laravel Vapor (Serverless) - IAC (Infrastructure as Code) Things to note Elastic Container Service (ECS)