Contact Information: +91 9958467876, contactus@ellitedevs.in

How to migrate your wordpress website to AWS Cloud from BigRock ???

Posted by ed_maverick in How-To | 0 comments

Big giants are moving to cloud. Cloud services provide easily scalability, security and high performance. They are cost effective as well. Amazon cloud or Amazon web services(AWS) is a leading player in this field. AWS is user friendly and it eases the user work. Below is a step by step guide to migrate your website from BigRock to AWS cloud. All these steps involve resources available in AWS free-tier. Hence this migration is completely free. We have also attached a step by step video in case you have any confusion at any step. So let’s get started.

1.Backup Database of exisiting website

  • Open phpMyAdmin in Cpanel
  • Go to the database to backup
  • Go to Export
  • Press Go to export the database

2.Backup Web files of Existing Website

  • Open file manager in Cpanel
  • Select the website folder to backup
  • Right click and select Compress
  • Select Zip file format
  • Once compressed, download the ZIP file

3.Create AWS EC2 Instance

  • Create an AWS account. This account can be created free of cost.
  • Login to your AWS Management console. Search for EC2 in search tab.
  • Go to EC2 > Instances > Launch Instance
  • Select LAMP Certified by Bitnami (Free tier eligible)
  • Press Continue
  • Select t2.micro (free tier eligible) instance
  • Press Configure Instance Details
  • Press Add Storage > Change size to 16 GB
  • Press Add Tags(tags are user-friendly names given to instance for easy identification)
  • Configure Security Groups > Add rule for HTTP and SSH access or select an existing group with same rules.
  • Press Review and Launch to launch the instance
  • Select a key pair (if you already have a key pair) else create a new key pair
  • Note down the Instance  Public IP address and Public DNS from details of the instance.

4.Log into AWS EC2 Instance via SSH with linux

We are using an Ubuntu VM in our video but you can perform these steps by installing an SSH client on your linux machine or by installing Putty on your windows machine.

For Linux users:
  • Launch terminal
  • Connect to the AWS EC2 Instance via ssh using the following command:

              ssh -i [path to the key pair file that you downloaded in step above] [username@Public DNS name]

For eg: We have launched a bitnami instance with Public DNS (ec2-44-84-220-198.compute-1.amazonaws.com) and username as bitnami. So command should be

                ssh -i /path/my-key-pair.pem bitnami@ec2-44-84-220-198.compute-1.amazonaws.com

For windows

In this post we are focusing on Linux .We will soon be  creating a separate detailed blog for windows SSH login. For now you can reference : https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html

5.Creating Directories for the website

  • Navigate to /opt/bitnami/apache2/htdocs
  • Create a directory with the name of the website using following command:  mkdir <dir name>
  • Change to this directory: cd <dir name>
  • Create a directory named conf : mkdir conf
  • Create a directory named: htdocs: mkdir htdocs
  • Change directory to conf : cd conf
  • Create httpd-app.conf file in this dir with following contents:

         <Directory “/opt/bitnami/apache2/htdocs/<dir name>/htdocs”>
               AllowOverride All
              Options FollowSymLinks
        <IfModule php5_module>
              php_value upload_max_filesize 80M
             php_value post_max_size 80M
       </IfModule>
           Allow from All
       </Directory>

  • Create httpd-vhosts.conf file in this dir with following contents:
                 <VirtualHost *:80>
                   ServerName <website name>
                  ServerAlias www.<website name>
                 DocumentRoot “/opt/bitnami/apache2/htdocs/<dir name>/htdocs”
                Include “/opt/bitnami/apache2/htdocs/<dir name>/conf/httpd-app.conf”  
              </VirtualHost>
  • Add following line to /opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf
           Include “/opt/bitnami/apache2/htdocs/<dir name>/conf/httpd-vhosts.conf”
  • Restart apache server:
     cd /opt/bitnami
     sudo ./ctlscript.sh restart apache

6.Upload web files file to AWS EC2 Instance

  • Upload the ZIP file
   scp -i “ellitedevs-sendy-key-pair2.pem” <zip file name> bitnami@ec2-54-84-220-198.compute-1.amazonaws.com:/home/bitnami/
  • Extract the zip file:
     unzip <zip filename>
  • Change to the unzipped directory
     cd <unzipped directory name>
  • Copy all files from this directory to /opt/bitnami/apache2/htdocs/<dir name>/htdocs/
     copy -R * /opt/bitnami/apache2/htdocs/<dir name>/htdocs/

7.Upload the database

  • Connect to AWC EC2 instance using the following command:
         ssh -N -L 8888:127.0.0.1:80 -i “ellitedevs-sendy-key-pair2.pem” bitnami@ec2-54-84-220-198.compute-1.amazonaws.com
  • Connect to AWS EC2 phpmyadmin:
          URL: http://127.0.0.1:8888/phpmyadmin
  • Login to phpmyadmin using bitnami instance credentials (check bitnami_credentials file in   /home/bitnami folder)
  • Create a user with the same username as it was on Bigrock
  • Use the same password
  • Select Create a database with same name and grant all privileges
  • Once the user and database is created, select that database
  • Go to Import
  • Select the downloaded .sql file
  • Press Go
  • If all went well, the database should have been imported successfully

8.Update A records (if using Bigrock shared hosting)

  • Login to Bigrock Cpanel
  • Go to Zone Editor
  • Select the website who’s name records need to be updated
  • Select the A record with website name
  • Click edit
  • In the value field enter the IP address of AWS EC2 instance
  • Save

Now finally open your website using your DNS name or Public IP of instance and it should work correctly

Note: Perform all these steps and your website should work. We will soon be coming with SSH on Windows blog and regarding hosting on AWS DNS(Route53). Stay Tuned for more. If you face any problem reach out to us at contactus@ellitedevs.in.

 

 

 

Tags: , , , , ,

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>