Part 3- Tutorial on Amazon EC2 RDS WordPress with SSH (Shh Don’t be scared:)

Continued from – Fast Amazon AWS Optimized WordPress EC2 RDS S3 Manual Cache Gzip Config – Part 1
Continued from – Amazon EC2 RDS WordPress – Part 2

Using SSH to Access Amazon AWS EC2 and RDS

The following will use Terminal on mac. If you are using a PC then you may decide to use PuTTY for your command line interface. Go for it. The most difficult part will be connecting and setting up the public key. Remember: If at first you don’t succeed. Don’t break your computer.

Terminal Commands for Amazon AWS EC2 and RDS

First open terminal in your mac. It will probably open with your username shown.

The first command is:
ssh -i /your/path/directory/YOURKEYPAIRNAME.pem ubuntu@Yo.ur.El.ast.ic.IP

(REPLACE THE IP Yo.ur.El.ast.ic.IP.. with the ASSOCIATED ELASTIC IP from the previous part of this tutorial. and the directory path to your key pair on your local machine)

If this does not connect the first time then you will want to play with the .pem file path. It may take a minute of frustration.

After you are into the server you should see that your are logged in as ubuntu@your.Elastic.IP.

Now run the following commands, some will take longer than others:

sudo apt-get update
sudo apt-get –yes upgrade
sudo apt-get –yes install apache2 mysql-client php5 php5-mysql php5-curl php5-gd php-apc emacs23-nox
sudo a2enmod rewrite
sudo a2enmod expires
sudo a2enmod headers
sudo a2enmod deflate

The first command updates the installation. The next upgrades it. Make sure you do this! Next you install packages. You then enable Apache2 modules.

There are two files that we will now need to update. The paths to these files from the root of your server are:


Edit the php.ini with the following terminal command:

sudo vi /etc/php5/apache2/php.ini

Once php.ini is open, click i for insert on your keyboard. Now find the line with:

upload_max_filesize = 2M

And replace it with:

upload_max_filesize = 10M

Or greater…

Now you will want to hit escape to exit the insert window. After that type 😡 and hit enter. You will return to the ubuntu user. Click cd .. to go back one directory or cd /thedirectoryforward to go up directories. Another great terminal command to help navigate is


ls will list all of your directories and files inside of the current directory.

ls -l

will list the permissions also.

Now it is time to edit the file located in /etc/apache2/sites-available/default.

At any time you become lost in terminal use the command “cd ..” or “ls”.

You will now use the command:

sudo vi /etc/apache2/sites-available/default

Using insert again, find AllowOveride and set to ALL


Now you will want to use this command to restart apache:

sudo service apache2 restart

MySQL RDS Setup and Configure

Using the following command, replace NAME, USERPASS and HOST.END.POINT with your Master Combo details. MAKE SURE YOU USE 2 DASHES> –user=…

sudo mysql –user=NAME –password=USERPASS –host=HOST.END.POINT

These are the Master Combo details used when setting up the RDS instance. Take out “sudo” if needed.

Once you are logged into mysql run the following commands, in order. (Before continuing, you should see mysql> in your terminal instead of ubuntu@YOUR.ELASTIC.IP) (Replace NAME, Host.End.Point, USERPASS and YourDBName with what you used in tutorial part 1 and 2 :-)





Continue on to Part 4- Setting up WordPress on Amazon AWS with RDS and S3

Comments are closed.