How to Install Apache, PHP 5.5 and Memcached on AWS EC2
AWS EC2 looks like a good choice when you need a clean instance ready for you to manage your own server as per your needs.
Recently, I launched an EC2 instance from a Linux AMI (Amazon Linux AMI 2014.09.1) to create my own web server with Apache and support for PHP 5.5. I know Amazon has the EB (Elastic Beanstalk) service which comes with the necessary stuff already installed to run your Java, Node, PHP,… applications so that you only need to upload your code to the server and EB will do the rest.
I have experience dealing with AWS EB in the past and the reason this time I chose EC2 instead of EB is that with EC2 you have total freedom to set up your server. For instance, I found difficulties setting up cron jobs on EB in the past, but with EC2 this is a simple administration task when you connect to the server through ssh.
What were the reasons that led me to choose AWS instead of a different hosting provider?
This is a typical question when you are looking for the best and cheapest hosting provider for your applications. My reasons here were two: scalability and location.
Scalability: With AWS is easy to scale up your applications in a timely manner and with very low effort.
Location: With AWS you can choose where to run your applications among different locations available all over the world or even replicate your application in different locations at the same time. The latter is what I wanted.
Below are the steps to configure your EC2 instance based on a Linux AMI to run Apache Web Server, PHP 5.5, Memcached server and memcache extension. The sources I gathered information from were basically the AWS guid to install a LAMP server and other forums around.
Connect to your instance using ssh. Make sure you have previously downloaded and securely stored your private key and the ssh service enabled in your security group