How to setup Drupal project instance on AWS EC2

09 Feb

How to setup Drupal project instance on AWS EC2

in AWS, Cloud, cloud migration, CloudComputing, Drupal, Drupal Planet, Drupal setup, ec2

In this blog I will drive you through setting up Drupal project instance on Ec2 micro instance of AWS and setting up ftp on your Drupal instance. Before this, of course you have to register with AWS which is straightforward.

So, what we will understand from this blog:-

1       Choosing OS and assigning some security rules on our instance.

2       How to access our instance and play around it?

3       Setting up LAMP on our AWS micro instance

4       Setting up ftp on AWS micro instance

5       Managing your Drupal project using ftp connection using filezilla

Once you are registered with AWS you have to login into your account. Among the AWS services just click on EC2 link which is nothing but a virtual server in the cloud. It will redirect you to EC2 dashboard where you can manage your entire instance. Now for creating new instance follow below steps:-

1       Just click on Launch instance select Classical wizard and click continue.

2       Now you have to select Amazon Machine Image (AMI) from one of the tabbed lists below by clicking its Select button.

3       Let’s say we select Ubuntu 12.04 LTS.

4       Next leave default settings except just select micro instance from the instance type because it’s free to use and click continue.

5       Next again leave default setting and click continue.

6       Next again leave default setting and click continue.

7       Now you have to give name of your key and value. I recommend give key value name more sensible with your project and click continue.

8       Now select creating a new key pair as we are new we don't have existed key pair. Give name to your key pair file it should make sense with regards to your project. Download your keypair.pem file and save at a safe place because we need this file later.

9       Next select create a new security group. Here we will assign some security rule and enable http, SSH and ftp connection to our instance. Http port range is 80 SSH port range is 22, for ftp select custom TCP rule and give port range 21-22. About source you can give any IP range as you need or just leave default for now.

10    Just click continue and launch instance. Your instance will be running in some time as AWS will take some time to run your instance.

Now our EC2 micro instance is running. You can check out from your dashboard.

Now we setup LAMP in our Ubuntu 12.04 LTS instance. For this we access our Ubuntu instance from terminal and setup LAMP in that. Below are the steps to access and setup your LAMP in Ubuntu 12.04 LTS instance.

1       Open your terminal and go to the directory where you stored your key pair file .pem file then run this command into your terminal sudo SSH -i file_name.pem Ubuntu@ec2-40-90-193.compute-1.amazonAWS.com .

2       It will give you Ubuntu prompt in your terminal. You can understand like this that now you are logged in into your Ubuntu machine and you can do anything over there. The main thing here is you have to run all commands with "sudo" or as a root user which works on file system directory.

3       In order to setup LAMP we will install three packages in it . Run these command from terminal :-

●       sudo apt-get install apache2

●       sudo apt-get install mysql-server

●       sudo apt-get php5 php-pear php5-mysql php5-suhosin

That's it your LAMP environment is ready. You can check it by navigating your instance url that is for example look like this ec2-43-23-32.compunte.AWS.com in browser. It will give you message Localhost is working something like that.

Till here we got our LAMP environment running into our EC2 instance. Now we install our Drupal 7 instance in it. Here in Ubuntu instance we don't have any ftp connection with ftp client or server. So we can use SCP for taking Drupal tarball from our local instance or we can use wget utility of linux to download Drupal from its url. Below are steps to install Drupal 7

1       cd /var/www/

2       wget  http://ftp.Drupal.org/files/projects/Drupal-7.12.tar.gz

3       tar xvf Drupal-7.12.tar.gz

4       mv Drupal-7.12 Drupal

Below is a link which can tell you how to install Drupal in linux . Just follow all those steps.

http://Drupal.org/documentation/install/developers

When you setup with your mysql database and Drupal configuration then just browser link like for example:

http://ec2-43-23-32.compute-1.amazonAWS.com/Drupal/

It will take you to your Drupal site.

Now we will see how to setup ftp on Drupal instance .Why we need ftp for Drupal instance. In order to work on Drupal we have to use many modules, themes and libraries. So we have to upload those things on site. We can achieve this with SCP but that will be more difficult because you have to do via command line.  Here we will see how to setup Filezilla ftp on Drupal site which is on AWS EC2. Below are the steps to setup filezilla as a ftp client.

1       Install filezilla  into your local system :- sudo apt-get install filezilla

2       Now open filezilla click on file > site manager

3       Enter the details of your site here like :-

●       HOST - ec2-43-23-32.compute-1.amazonAWS.com

●       Port- 22

●       Protocol - SFTP(SSH file transfer protocol )

●       Logon Type - Normal

●       User - Ubuntu

●       Password - Ubuntu . Then click on ok don't click on connect this time.

1       Now click on Edit> Settings > SFTP and addkeyfile. Navigate your .pem file here. It will ask you to convert .pem file just select ok. Now filezilla have your instance credentials to connect and everything is good to connect to your Drupal instance.

2       Now click on file > site manager > connect

Now you can transfer all files from your local to Drupal instance.

 

I hope you enjoyed this blog. Please feel free to comment and send queries to me.

 

Reference:-

https://AWS.amazon.com/documentation/

http://library.linode.com/lamp-guides/Ubuntu-12.04-precise-pangolin

 

Thanks for reading draft of this. Appreciate your help and contribution.

copyright 2012 10jumps Llc.

copyright 2012 10jumps LLC.