SlideShare a Scribd company logo
Scale out our PHP application with 
ElasticBeanstalk
About me 
Cofounder 
Cofounder 
Corley S.r.l. - @CorleyCloud 
UpCloo LTD - @UpCloo 
on Github 
on Twitter 
wdalmut 
walterdalmut 
- Internet Of Things! @ Turin [CFP] - 15 Nov 
- CloudComputing @ Turin [CFP ASAP] 
internetof.it 
www.cloudconf.it
ElasticBeanstalk 
Scale your app workers and web apps 
Queue Daemons 
Load balanced web applications 
Mainly for Service Oriented Architecture
Autoscaling applied to web applications
Scale apps is not simple 
How to handle dev/testing/production? (dynamic env) 
How to install/update softwares? (dynamic env) 
How to handle user sessions? (more than one node) 
How to handle/tail logs? (dynamic env) 
How to monitor all instances (dynamic env) 
And more... (all things are moving!)
Run different environment per app 
Typically you run: Production, Testing, Development
Different app versions per environment 
Easy distributed app deploy/rollback and testing/production application management
Different configuration per environment 
Upgrade your environment and switch your production without downtime
Production Env Swap
My production environment
Add a new environment
Swap production environment 
ElasticBeanstalk swap env URLs in order to simplify the upgrade
Destroy your old environment 
COST-SAVING! 
it is easier create and destroy environments than upgrade them
Environment Management
Your scaling policies
Scaling made easy
Application variables 
All environment variables are ported to your application in $_SERVER 
You can pass everything like: Memcached and Mysql configurations etc.
Use Composer for Dependencies 
ElasticBeanstalk uses composer in order to prepare your application 
Use composer hooks in order to connect all env variables to your app 
configuration
Composer hooks 
{ 
/** other composer configs **/ 
"scripts": { 
"post‐update‐cmd": [ 
"CorleyDeployMagento::updateConf" 
], 
"post‐install‐cmd": [ 
"CorleyDeployMagento::updateConf" 
] 
}, 
}
<?php 
namespace CorleyDeploy; 
use ComposerScriptEvent; 
class Magento 
{ 
public static function updateConf(Event $event) 
{ 
if (array_key_exists("OVERWRITE_CONF", $_SERVER)) { 
// Update your config file when $_SERVER contains "OVERWRITE_CONF" variable 
} 
} 
}
Need more customizations? 
Create a folder in your project root with name .ebextensions and 
append your configuration files with extension .config 
ElasticBeanstalk will use them during the application provisioning
Cronjobs runs on the leader instance only 
.ebextensions/05_cron_jobs.config 
container_commands: 
01_magento_cron_job: 
command: "cat .ebextensions/magento_cron_job.txt > /etc/cron.d/magento_cron_job && chmod 644 /etc/cron.d/magento_cron_leader_only: true 
All configuration files are just simple YAML files
Monitor your environment 
You can monitor many metrics with CloudWatch 
UDP/IP CloudWatch agent on local machine: https://github.com/wdalmut/cloudwatch-agent
What we are missing? 
Logs!
Grab all active instances logs
But my application logs? 
commands: 
21_application_logs: 
command: echo "/var/app/current/var/log/*.log" > myapp.conf 
cwd: /opt/elasticbeanstalk/tasks/bundlelogs.d 
22_application_logs: 
command: echo "/var/app/current/var/log/*.log" > myapp.conf 
cwd: /opt/elasticbeanstalk/tasks/systemtaillogs.d 
23_application_logs: 
command: echo "/var/app/current/var/log/*.log" > myapp.conf 
cwd: /opt/elasticbeanstalk/tasks/taillogs.d 
24_application_logs: 
command: echo "/var/app/current/var/log/*.log" > myapp.conf 
cwd: /opt/elasticbeanstalk/tasks/publishlogs.d 
.ebextensions/06_prepare_logs.config
Collecting all application logs 
AWS ELB can store all logs into a S3 bucket using a scheduled system 
COST-SAVING! we don't need to propagate logs via "rsyslog"
Thanks for listening 
Any question?

More Related Content

PDF
Symfony2 Specification by examples
PPTX
Ultimate Productivity Tools
PDF
Chris Omland - AWS Code Deploy - BSDC 2016
PPTX
Build and deployment with Jenkins and Code Deploy on AWS
PDF
Automated-Testing-inside-containers
PDF
Testing as a container
PPTX
CloudExpo 2018: Docker - Power Your Move to the Cloud
Symfony2 Specification by examples
Ultimate Productivity Tools
Chris Omland - AWS Code Deploy - BSDC 2016
Build and deployment with Jenkins and Code Deploy on AWS
Automated-Testing-inside-containers
Testing as a container
CloudExpo 2018: Docker - Power Your Move to the Cloud

What's hot (20)

PDF
Continuous delivery in AWS
PPTX
Eclipse RCP Overview @ Rheinjug
PPTX
Linuxing in London: Docker Intro Workshop
PDF
KKBOX WWDC17 Xcode IDE - Hardy
PPTX
Docker, OSS and Azure
PPTX
CI/CD Pipeline with Docker
PPTX
TechDays NL 2017: The Hybrid Docker Swarm
PPTX
Localize content Devops
PDF
Continuous Delivery for Microservice Architectures with Concourse & Cloud Fou...
PDF
Criando pipelines de entrega contínua multilinguagem com Docker e Jenkins
PPTX
AngularJS: Service, factory & provider
PPTX
Xpirit MeetUp: Docker Windows Workshop
PPTX
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...
PPTX
DockerCon 17 EU: Modernizing .NET Apps with Docker
PDF
Lessons Learned Building a Container App Library
PPT
Continuous integration
PPTX
Docker on Windows: From 101 to Modernizing .NET Apps
PPTX
Android Apps Using C# With Visual Studio And Xamarin
PDF
CI/CD with Docker on AWS
PDF
Zalenium - SeleniumConf Austin 2017
Continuous delivery in AWS
Eclipse RCP Overview @ Rheinjug
Linuxing in London: Docker Intro Workshop
KKBOX WWDC17 Xcode IDE - Hardy
Docker, OSS and Azure
CI/CD Pipeline with Docker
TechDays NL 2017: The Hybrid Docker Swarm
Localize content Devops
Continuous Delivery for Microservice Architectures with Concourse & Cloud Fou...
Criando pipelines de entrega contínua multilinguagem com Docker e Jenkins
AngularJS: Service, factory & provider
Xpirit MeetUp: Docker Windows Workshop
Running eZ Platform on Kubernetes (presented by Björn Dieding at eZ Conferenc...
DockerCon 17 EU: Modernizing .NET Apps with Docker
Lessons Learned Building a Container App Library
Continuous integration
Docker on Windows: From 101 to Modernizing .NET Apps
Android Apps Using C# With Visual Studio And Xamarin
CI/CD with Docker on AWS
Zalenium - SeleniumConf Austin 2017
Ad

Viewers also liked (13)

PPTX
Corley scalability
PDF
Build a custom (micro)framework with ZF2 Components (as building blocks)
PDF
Cloud party 2014 - Deploy your infrastructure with Saltstack - Salt Cloud wit...
PPTX
MySQL - Scale Out @ CloudParty 2013 Milano Talent Garden
PDF
From Chef to Saltstack on Cloud Providers - Incontro DevOps 2015
PPTX
Php & cloud computing
PPTX
Disaster Recovery - On-Premise & Cloud
PDF
An introduction to Hubot - CloudConf 2015 - Turin Italy
PDF
Middleware PHP - A simple micro-framework
PPTX
Cloud computing & lamp applications
PDF
Scale your Magento app with Elastic Beanstalk
PDF
React vs Angular2
PDF
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
Corley scalability
Build a custom (micro)framework with ZF2 Components (as building blocks)
Cloud party 2014 - Deploy your infrastructure with Saltstack - Salt Cloud wit...
MySQL - Scale Out @ CloudParty 2013 Milano Talent Garden
From Chef to Saltstack on Cloud Providers - Incontro DevOps 2015
Php & cloud computing
Disaster Recovery - On-Premise & Cloud
An introduction to Hubot - CloudConf 2015 - Turin Italy
Middleware PHP - A simple micro-framework
Cloud computing & lamp applications
Scale your Magento app with Elastic Beanstalk
React vs Angular2
Deploy and Scale your PHP App with AWS ElasticBeanstalk and Docker- PHPTour L...
Ad

Similar to Scale your PHP application with Elastic Beanstalk - CloudParty Genova (20)

PDF
AWS ElasticBeanstalk and Docker
PDF
Scaling Django Apps using AWS Elastic Beanstalk
PPT
Why Managed Service Providers Should Embrace Container Technology
PPTX
DevOps with Elastic Beanstalk - TCCC-2014
PPTX
LearnBop Blue Green AWS Deployments - October 2015
PDF
Scaling Up with PHP and AWS
PDF
Advanced Topics in Continuous Deployment
PDF
E301 Elastic Beanstalk PaaS
PPTX
Elastic beanstalk
PPTX
Deploying your web application with AWS ElasticBeanstalk
PPTX
Midwest PHP - Scaling Magento
PDF
Distribua, gerencie e escale suas aplicações com o aws elastic beanstalk
PDF
[HKOSCON][20180616][Containerized High Availability Virtual Hosting Deploymen...
PDF
AWS: Scaling With Elastic Beanstalk
PDF
Deploying PHP Applications to AWS Elastic Beanstalk
PPTX
More developers on DevOps with Docker orchestration
PPTX
1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro
PPTX
AWS elastic beanstalk
PDF
Auto scaling applications in 10 minutes (CakeFest 2013)
PDF
DevOps for Drupal: Why We Cook With Chef
AWS ElasticBeanstalk and Docker
Scaling Django Apps using AWS Elastic Beanstalk
Why Managed Service Providers Should Embrace Container Technology
DevOps with Elastic Beanstalk - TCCC-2014
LearnBop Blue Green AWS Deployments - October 2015
Scaling Up with PHP and AWS
Advanced Topics in Continuous Deployment
E301 Elastic Beanstalk PaaS
Elastic beanstalk
Deploying your web application with AWS ElasticBeanstalk
Midwest PHP - Scaling Magento
Distribua, gerencie e escale suas aplicações com o aws elastic beanstalk
[HKOSCON][20180616][Containerized High Availability Virtual Hosting Deploymen...
AWS: Scaling With Elastic Beanstalk
Deploying PHP Applications to AWS Elastic Beanstalk
More developers on DevOps with Docker orchestration
1 DevOp vs 1.000 servers - Amazon EC2 and Chef automation intro
AWS elastic beanstalk
Auto scaling applications in 10 minutes (CakeFest 2013)
DevOps for Drupal: Why We Cook With Chef

More from Corley S.r.l. (20)

PDF
Aws rekognition - riconoscimento facciale
PDF
AWSome day 2018 - scalability and cost optimization with container services
PDF
AWSome day 2018 - API serverless with aws
PDF
AWSome day 2018 - database in cloud
PDF
Trace your micro-services oriented application with Zipkin and OpenTracing
PDF
Apiconf - The perfect REST solution
PDF
Apiconf - Doc Driven Development
PDF
Authentication and authorization in res tful infrastructures
PDF
Flexibility and scalability of costs in serverless infrastructures
PDF
CloudConf2017 - Deploy, Scale & Coordinate a microservice oriented application
PDF
A single language for backend and frontend from AngularJS to cloud with Clau...
PPTX
The advantage of developing with TypeScript
PDF
Angular coding: from project management to web and mobile deploy
PDF
Corley cloud angular in cloud
PDF
Measure your app internals with InfluxDB and Symfony2
PDF
Read Twitter Stream and Tweet back pictures with Raspberry Pi & AWS Lambda
PDF
Cloud Conf 2015 - Develop and Deploy IOT Applications
PDF
AngularJS advanced project management
PDF
Raspberry Pi - HW/SW Application Development
PDF
Time series database, InfluxDB & PHP
Aws rekognition - riconoscimento facciale
AWSome day 2018 - scalability and cost optimization with container services
AWSome day 2018 - API serverless with aws
AWSome day 2018 - database in cloud
Trace your micro-services oriented application with Zipkin and OpenTracing
Apiconf - The perfect REST solution
Apiconf - Doc Driven Development
Authentication and authorization in res tful infrastructures
Flexibility and scalability of costs in serverless infrastructures
CloudConf2017 - Deploy, Scale & Coordinate a microservice oriented application
A single language for backend and frontend from AngularJS to cloud with Clau...
The advantage of developing with TypeScript
Angular coding: from project management to web and mobile deploy
Corley cloud angular in cloud
Measure your app internals with InfluxDB and Symfony2
Read Twitter Stream and Tweet back pictures with Raspberry Pi & AWS Lambda
Cloud Conf 2015 - Develop and Deploy IOT Applications
AngularJS advanced project management
Raspberry Pi - HW/SW Application Development
Time series database, InfluxDB & PHP

Recently uploaded (20)

PDF
DevOps & Developer Experience Summer BBQ
PDF
KodekX | Application Modernization Development
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Advanced IT Governance
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
PDF
Sensors and Actuators in IoT Systems using pdf
PDF
Event Presentation Google Cloud Next Extended 2025
PPTX
Cloud computing and distributed systems.
PDF
CIFDAQ's Teaching Thursday: Moving Averages Made Simple
PDF
cuic standard and advanced reporting.pdf
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
DevOps & Developer Experience Summer BBQ
KodekX | Application Modernization Development
Dropbox Q2 2025 Financial Results & Investor Presentation
Advanced IT Governance
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Chapter 3 Spatial Domain Image Processing.pdf
Review of recent advances in non-invasive hemoglobin estimation
“AI and Expert System Decision Support & Business Intelligence Systems”
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Sensors and Actuators in IoT Systems using pdf
Event Presentation Google Cloud Next Extended 2025
Cloud computing and distributed systems.
CIFDAQ's Teaching Thursday: Moving Averages Made Simple
cuic standard and advanced reporting.pdf
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
Understanding_Digital_Forensics_Presentation.pptx
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
NewMind AI Monthly Chronicles - July 2025
AI And Its Effect On The Evolving IT Sector In Australia - Elevate

Scale your PHP application with Elastic Beanstalk - CloudParty Genova

  • 1. Scale out our PHP application with ElasticBeanstalk
  • 2. About me Cofounder Cofounder Corley S.r.l. - @CorleyCloud UpCloo LTD - @UpCloo on Github on Twitter wdalmut walterdalmut - Internet Of Things! @ Turin [CFP] - 15 Nov - CloudComputing @ Turin [CFP ASAP] internetof.it www.cloudconf.it
  • 3. ElasticBeanstalk Scale your app workers and web apps Queue Daemons Load balanced web applications Mainly for Service Oriented Architecture
  • 4. Autoscaling applied to web applications
  • 5. Scale apps is not simple How to handle dev/testing/production? (dynamic env) How to install/update softwares? (dynamic env) How to handle user sessions? (more than one node) How to handle/tail logs? (dynamic env) How to monitor all instances (dynamic env) And more... (all things are moving!)
  • 6. Run different environment per app Typically you run: Production, Testing, Development
  • 7. Different app versions per environment Easy distributed app deploy/rollback and testing/production application management
  • 8. Different configuration per environment Upgrade your environment and switch your production without downtime
  • 11. Add a new environment
  • 12. Swap production environment ElasticBeanstalk swap env URLs in order to simplify the upgrade
  • 13. Destroy your old environment COST-SAVING! it is easier create and destroy environments than upgrade them
  • 17. Application variables All environment variables are ported to your application in $_SERVER You can pass everything like: Memcached and Mysql configurations etc.
  • 18. Use Composer for Dependencies ElasticBeanstalk uses composer in order to prepare your application Use composer hooks in order to connect all env variables to your app configuration
  • 19. Composer hooks { /** other composer configs **/ "scripts": { "post‐update‐cmd": [ "CorleyDeployMagento::updateConf" ], "post‐install‐cmd": [ "CorleyDeployMagento::updateConf" ] }, }
  • 20. <?php namespace CorleyDeploy; use ComposerScriptEvent; class Magento { public static function updateConf(Event $event) { if (array_key_exists("OVERWRITE_CONF", $_SERVER)) { // Update your config file when $_SERVER contains "OVERWRITE_CONF" variable } } }
  • 21. Need more customizations? Create a folder in your project root with name .ebextensions and append your configuration files with extension .config ElasticBeanstalk will use them during the application provisioning
  • 22. Cronjobs runs on the leader instance only .ebextensions/05_cron_jobs.config container_commands: 01_magento_cron_job: command: "cat .ebextensions/magento_cron_job.txt > /etc/cron.d/magento_cron_job && chmod 644 /etc/cron.d/magento_cron_leader_only: true All configuration files are just simple YAML files
  • 23. Monitor your environment You can monitor many metrics with CloudWatch UDP/IP CloudWatch agent on local machine: https://github.com/wdalmut/cloudwatch-agent
  • 24. What we are missing? Logs!
  • 25. Grab all active instances logs
  • 26. But my application logs? commands: 21_application_logs: command: echo "/var/app/current/var/log/*.log" > myapp.conf cwd: /opt/elasticbeanstalk/tasks/bundlelogs.d 22_application_logs: command: echo "/var/app/current/var/log/*.log" > myapp.conf cwd: /opt/elasticbeanstalk/tasks/systemtaillogs.d 23_application_logs: command: echo "/var/app/current/var/log/*.log" > myapp.conf cwd: /opt/elasticbeanstalk/tasks/taillogs.d 24_application_logs: command: echo "/var/app/current/var/log/*.log" > myapp.conf cwd: /opt/elasticbeanstalk/tasks/publishlogs.d .ebextensions/06_prepare_logs.config
  • 27. Collecting all application logs AWS ELB can store all logs into a S3 bucket using a scheduled system COST-SAVING! we don't need to propagate logs via "rsyslog"
  • 28. Thanks for listening Any question?