Create and mount an EBS volume to your AMAZON instance

In this series so far I explained to set up basic PHP application and use of RDS for relational databases.

For the same couple of times we faced the issue that somehow the instance health check url returned false and as a result our instance got terminated, so we need to again re upload the entire data associate elastic ip etc that is somewhat hectic process

So we googled for the solution and came to know that if instance got restarted the local file system will be lost and you cant retain the data, the solution is to use the persistent storage so even in case of failure the data should remain.

Couple of options are available, some suggested to use bucket and some advised to use the EBS volumes.

I followed the EBS volumes

An informative guide can be found HERE 

Actually its pretty straight forward if you have some advanced linux knowledge for filesystems.

First i created the empty EBS volume, make sure for the availability zone as one volume may not available to other zones.

Ater that you need to associate the volume to your instance use between the range sdc to sdp as sda and sdb are already in use

After assigning to specific instance you can ssh to your instance and see its attached.

Before mounting for first time you need to format the ebs volume by following command

sudo mkfs.xfs /dev/sdc

Where “sdc” is the point of attachment at the time of attaching to instance

After create an empty directory to mount volume with  mkdir command

And final step is to actually mount it

mount /dev/xvdp /wb1

wb1 is the directory created to mount the drive



How to configure a basic php application on amazon ec2

The most important thing is you need your valid amazon login details

Login with the credentials and you will land on the home screen, dont get confused with various options to setup working php mysql application you need a few options.

The first most important thing is to generate a ssh key and import in the console A good guide on how to generate can be found HERE

Once imported name the key you can remember say php or mykey etc I use php.

Next you can go to Elastic Beanstalk section, select launch new environment.

Choose the required parameters the most important is container type

Select the one which suits you for your php mysql I selected 32 bit amazon linux running php 5.3

Check the parameters for most of columns dont change any but to keep the default one

After filling all the details your environment is can be seen on the same screen, wait for the color or environment to change to green which indicates ALL IS WELL…

You are now almost 50% done till this step.

Go to environment url to check the sample code working, some welcome app or sample application screen

If not then there is something wrong and you can check the environment logs or events to check status.

Next go to EC2 section and your newly created instance is waiting for you.

Its now time to access the newly created instance to upload some files.

Allocate one Elastic Ip from the EC2->Elastic IP section to your instance.

In the instance details you can now see the IP allocated. Just to confirm type that IP address in browser and you should see the same app page that was there while checking the environment url.

Next step is set up putty to access the instance.

Convert the generated key in first step to PPK (Putty Private Key) format. An illustrative guide can be found HERE.

For a Quick revision we followed steps as

  1. Generated key pair
  2. Created instance with default environment
  3.  Imported keys to ec2  environment
  4.  Edited instance to allocate the IP to allow SSH
Next step is to actually ssh your newly created instanceGo to instance section under EC2->instances and click on your instance and note down the elastic IP associated.
Now Open the Puty for SSH connection
In connection details put your elastic IP and under SSH -> Auth section browse the ppk file you created.
When prompted enter user name as ec2-user and password as what you selected while creating your key.


If  ALL IS WELL you can see the favorite black screen for linux console.. Its now your play ground.. and now time to do some settings.
Check for php version and apache version for curiosity, Its not necessary but to start with or to brush your knowledge if you are accessing it after long time like me.
The default apache location is /etc/httpd/
and default webroot will be /var/www/html
Edit some files or create a new one..using VI editor and check on front end..

How to configure the amazon relational database service to use in amazon cloud applications

This is new series where in I will explain step by step configuration of the amazon cloud servers to host and run php mysql applications


In this session I will first explain to use ARDS (Amazon Relational Database Service) and then binding the ARDS instance to get accessible from your app.


The main requirement is you should have AWS account.  Login with your credentials and go ahead to create your first ARDS db

First select RDS tab from the top menu

Then select launch new instance

Select available instances like mysql,oracle,MSSQL etc

Fill in the necessary details like instance class, storage, db identifier, username, password etc



Once selected all the necessary options the DB instance is now seen on RDS dashboard.

Next Step is to authorize access to your database

Select the db security group from the left hand side options

Possible select the default security group and grant access for application or the specific IP to access the same.

After authorized access you can now access your database

Note the EndPoint url username and password

With this credentials and security settings you can now connect to your db instance.