Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

Set Kyar Wa Lar Backend Developer - Affyn (Node.js) MyanmarDevJobs.com DevOps Engineer Backend Engineer (Laravel) ABOUT ME

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

Single EC2 Instance Topics 01 Multiple EC2 instances 02 AWS Manage ALB, ASG, Opensearch, RDS, S3 03 AWS ECS/EKS 04

Slide 5

Slide 5 text

Single EC2 Instance

Slide 6

Slide 6 text

Pro - Easy to maintain Con - Hard to scale horizontally Single EC2 Instance

Slide 7

Slide 7 text

Let’s move on to Multiple EC2 Instances - Application got more traffic - Can’t handle with one single EC2 instances Why?

Slide 8

Slide 8 text

Multiple EC2 Instances

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

Pro - Able to scale horizontally Con - Scaling in/out are manual - Tedious to update something like (PHP Version) Multiple EC2 Instances

Slide 11

Slide 11 text

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)

Slide 12

Slide 12 text

Auto Scaling Group (ASG)

Slide 13

Slide 13 text

Pro - Able to auto scale horizontally Con - You need to manage Golden Image Auto Scaling Group (ASG)

Slide 14

Slide 14 text

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)

Slide 15

Slide 15 text

Elastic Container Service (ECS)

Slide 16

Slide 16 text

- 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)

Slide 17

Slide 17 text

Do you have any questions? Thanks!