NOTE: The really easy way to create Drupal instances on AWS would be to use a BitNami AMI.
But if you really want to do it manually, here’s a brief tutorial on installing Drupal on AWS.
Deploying your server at Amazon and connecting to it
- Sign up for Amazon Web Services.
- Go to the EC2 console page.
- On the left navbar, select an appropriate region, such as US-East.
- On the left navbar, click “Security Groups.”
- Click the button to “Create Security Group.”
- Name your security group something like “webservers.”
- Describe your security group as “HTTP + SSH.”
- Make sure “No VPC” is selected.
- Click to create the security group.
- On the security groups screen, select your new security group. A panel should appear at the bottom of the page.
- Click the “Inbound” tab.
- Select SSH and click “Add Rule,” and then do the same for HTTP.
- Click the “Apply Rule Changes” button.
- On the left navbar, select EC2 dashboard.
- Click the large “Launch Instance” button. That starts the Quick Launch Wizard.
- Name your instance–perhaps something like “Drupal 1.”
- For your key pair, select “Create New” and name it–perhaps something like “AMI Key Pair 1.”
- Beside the key pair input area, click the “Download” button and save your key pair to somewhere you’ll remember it, such as your Documents folder. You will need to know the complete directory path to the file in text form, not just how to find it by clicking.
- Select the default 64-bit Amazon Linux AMI (EBS-backed for persistent storage).
- Click “Continue,” and on the next screen, click “Edit Details.”
- Note that t1.micro, the free option, is selected for the machine size. A small instance is probably the minimum for Drupal, and you may need a larger instance: both have some cost.
- Open the “Security Settings” sub-panel, and select the security group you created earlier.
- Click “Save Details,” and on the next screen, “Launch.”
- On the left navbar, select “Instances.”
- Click the checkbox on the far left of your new instance.
- On the “Instance Actions” drop-down list, select “Connect.”
- Click “Connect from your browser using the Java SSH Client.”
- Type in the path to the key you created, above.
- Click “Launch SSH Client.”
- You probably need to grant the application permission to run in your browser, and you may need to ensure your Java installation is working and try again.
- The SSH client will ask about several things–just click “Yes.”
Configuring your web server and installing Drupal
- sudo yum update
- sudo yum install -y httpd perl gd php php-pear mysql mysql-server php-common php-dba php-pdo php-mysql php-xml php-xmlrpc php-gd
- sudo chkconfig –level 2345 httpd on
- sudo chkconfig –level 2345 mysqld on
- Get a little better MySQL config by following these instructions. For production servers, you will probably want to configure either additional or larger EBS volumes and set up snapshots by following these instructions.
- sudo /etc/init.d/mysqld start
- sudo /etc/init.d/httpd start
- mysql -u root mysql
- (On production servers, follow these instructions to set up new passwords for mysql’s root account.)
- create database drupal;
- grant all privileges on drupal.* to ‘drupal’@’localhost’;
- set password for ‘drupal’@’localhost’ = password(‘dfsdfsdfsdfsfetc.etc.’);
- flush privileges;
- sudo useradd drupal
- sudo chown drupal /var/www/html
- sudo su drupal
- pear config-create $HOME $HOME/.pearrc
- pear channel-discover pear.drush.org
- pear install drush/drush
- In /home/drupal/.bash_profile, add ‘PATH=”/home/drupal/pear/:$PATH”‘ and ‘export PATH’; then source /home/drupal/.bash_profile
- cd /var/www/html
- curl http://ftp.drupal.org/files/projects/drupal-7.12.tar.gz > drupal-7.12.tar.gz
- gunzip drupal-7.12.tar.gz
- tar -xvf drupal-7.12.tar
- mv drupal-7.12 demo
- rm drupal-7.12.tar
- Leave your command prompt open and ready.
Working with your new Drupal site
- Go back to the EC2 admin console and find the “Public DNS” setting for your Drupal instance (for production, allocate an Elastic IP and use your DNS provider to point an A record at that).
- Copy/paste that setting as a URL (http://) plus /demo on the end, e.g. http://ec2-50-16-169-128.compute-1.amazonaws.com/demo