Web Hosting on Amazon AWS (PHP + MySQL) Web Hosting on Amazon AWS (PHP + MySQL) php php

Web Hosting on Amazon AWS (PHP + MySQL)


Depends on your needs. Elastic Beanstalk might be a good option for many apps, but I chose EC2 for my app's backend (using PHP, MySQL and S3 for storage).

Quick steps to get you up and running:

  1. Log into the AWS Mangement Console and start a new EC instance (Windows server 2012 R2 Base > t2.micro should be good enough for a start!)

  2. At step "6. Configure Security Group", add Rules for at least HTTP, HTTPS and RDP (so you can connnect via Remote Desktop)

  3. Connect to your new instance via Remote Desktop and install a decent browser (Enable File Downloads in IE's Security Settings and download Chrome or Firefox)

  4. Open the Windows Firewall and add rules for the same ports you opened in the Security Group of your Instance in the AWS Management Console. (Right-click on “Inbound Rules”, then select “New Rule…”)

  5. Download and install XAMPP (I put it in C:\xampp)

  6. Open the XAMPP Control panel and install Apache and MySQL as services (so they will start automatically when your instance launches); make sure everything is started up.

  7. Now put your files in C:\xampp\htdocs\ and you're ready to go!

Bonus Steps:

  • Set up Filezilla FTP Server (and open the required ports in both the instance's security group and the Windows Firewall) so you can upload/download files without having to go through Remote Desktop.

  • Get an Elastic IP and assign it to your instance, so it's IP address will never change.

  • Get an SSL certificate so you can use HTTPS


The answer depends on the load that you are expecting and the resources you have to handle all the administration tasks.

If you expect heavy or variable loads, there are many reasons why not to deploy a production PHP + MySQL application on a EC2.

Here are some of the benefits of deploying to Elastic Beanstalk instead of a manual configured EC2:

  • You get version control of each deployment.

  • You can scale up or down automatically if you need more/less instances to handle new load.

  • You get a load-balancer in front of your EC2s instances with a bunch of out-of-the-box "recommended" configurations.

Regarding MySQL, if you go for an Amazon RDS instance you can handle replication, monitorization and automatic backups with pretty low effort. A lot of the configurations you would need to tweak are now available through parameter-groups.

On the other hand, if you want to have full control of everything that is going on on your server (that means you have time to monitor, backup and do maintenance tasks, which is not my case :), or if you do not plan to have much traffic, or if you want the less expensive option, you should go with a low cost EC2 instance.

In my experience, (after 2 years of working on AWS with 10 production applications, I'm kind of a regular AWS user) pretty much every customization or change I needed on both RDS and EBS I was able to tweak it and get it working, so I'm pretty satisfied with choosing the EBS+RDS option.