0

I set up an Elastic Beanstalk PHP environment.

On the EC2 instance, I installed a few other packages, including PhpMyAdmin and did various changes to the instance to get the configuration that I'm looking for. I also uploaded all of my website's files to /var/www/html.

But I'm confused as to how this all scales. Say my single instance's performance is peaking, and AWS determines that I need a second instance to keep up with the demand.

How does Elastic Beanstalk create a second instance of my EC2 server, along with PhpMyAdmin (and the other packages), as well as all my website's files in /var/www/html?

Would I then have two servers with PhpMyAdmin and my website files? How does it know how to re-install PhpMyAdmin on the second instance, and configure it in the same way my first instance is configured?

Thanks.

0

When using Elastic Beanstalk and/or Auto Scaling (EB uses Auto Scaling under the hood), if you do anything manually to the EC2 instances, those changes will not propogate to the other EC2 instances magically.

So PhpAdmin will not automatically be installed on the other EC2 instances, and if you manually uploaded your PHP application to /var/www/html, then that will be lost too.

When using Elastic Beanstalk, you need to keep in mind that:

  • Your single EC2 instance may be replaced at any time. Thus, any manual changes you make to the instance(s) will be gone.
  • Any additional EC2 instances added via scaling up will not have those manual changes.
  • When launched, all EC2 instances will be the default configuration of (a) base EB AMI + (b) the PHP application version deployed via EB (not manually).

So, always do the following:

  • Deploy all versions of your PHP application via the Elastic Beanstalk interface, never manually.
  • Keep all data off the instance. This means, all database files, uploaded user data, etc. should be in S3, RDS, or some other storage medium outside of your Elastic Beanstalk Auto Scaling group. Only web server source code and/or deployables should be on your EC2 instances.
  • Customize your EC2 instances via the .ebextensions files.

Additional resources:

  • Thanks for that info! Additionally, how can I update my PHP application via git/github? I push all my changes to my github, so I'm wondering how I would update my PHP application on Elastic Beanstalk? – user4165314 Jul 8 '17 at 19:45
  • @user4165314 You should ask that as a new question. – Matt Houser Jul 8 '17 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.