Amazon RDS in 10 mins
Amazon’s Relational Database Service (RDS) offers hosted MySQL database in the cloud.
In pre RDS era, you would have fired up an instance, installed MySQL yourself on it, configured an EBS volume so that the database data storage is persistent. You would have setup a cron to snapshot your EBS volume. But RDS saves the headache of managing an EBS volume and your instance separately. It offers you installed MySQL with persistent storage. It also offers you automated database backup. And setting it up is as easy as 1,2,3…
Here is what you do to setup a database using RDS:
1) Sign up for RDS by visiting http://aws.amazon.com/rds.
2) Install RDS tools on your local machine so that you can execute RDS setup commands. You can download the toolkit from the download page.
Installation of the client toolkit involves the following procedure:
a) Unzip the downloaded file into a suitable folder, say /home/vaibhav/software/rds-tools
b) Make sure that you have java 1.5 or up installed on your machine andĀ JAVA_HOME variable is set. If not install the latest version of java and set JAVA_HOME to the folder where java is installed.
c) Set AWS_RDS_HOME=/home/vaibhav/software/rds-tools in your .bashrc or execute the following command to set AWS_RDS_HOME for this session
export AWS_RDS_HOME=/home/vaibhav/software/rds-tools
d)Add AWS_RDS_HOME to your path by executing export PATH=$PATH:$AWS_RDS_HOME/bin
e) Rename credential-file-path.template in AWS_RDS_HOME (/home/vaibhav/software/rds-tools) to any name of your choice say credentials.txt. Set AWS_CREDENTIAS_FILE variable by executing
export AWS_CREDENTIAL_FILE=<the path of the file created above - credentials.txt
3) Now let’s create a security group before creating a database instance. This is because we would like to supply this security group while creating an instance. A security group can be created by executing
rds-create-db-security-group --db-security-group-name databaseĀ --db-security-group-description 'Default mysql database security group'
This will create a security group called database. If you want to connect to the mysql server from your local machine, you will need to add authorization to this group by executing
rds-authorize-db-security-group-ingress --db-security-group-name database -i 71.168.56.100/32
Here 71.168.56.100/32 is the ip address range of the network from which you want to access the database and 123456789012 is your Amazon AWS account number
4) Now create the database instance. The database instance can be created by executing the following command:
rds-create-db-instance --db-instance-identifier reporting --allocated-storage 5 --db-instance-class db.m1.small --engine MySQL5.1 --master-username master --master-user-password s0mePassw0rd --db-name MyFirstDb --availability-zone us-east-1a --preferred-maintenance-window Sun:12:00-Sun:16:00 --preferred-backup-window 10:00-12:00 --db-security-groups database --headers
There are few parameters that you need to understand very well before executing this command. The preferred-maintenance-window is the 4 hour time period Amazon requires to apply patches and to carry out other maintenance tasks on the database server. preferred-backup-window is the daily two hour window in which your database will be backed up. The database won’t be down in the period, but its performance could get affected because of the backup operation. Please note that both the time periods must be specified in UTC time. If you are going to access this database from an Amazon ec2 instance then choose an availability zone that is the same as the web server so that you are not charged for the bandwidth. You should change other parameters such as the database instance type, allocated storage as per your requirement. More information on these parameters can be obtained from the CLI reference page. The instance name will be reporting as specified. To find out its address, you can simply execute
rds-describe-db-instances
This command will list all the db instances with their dns names. The dns name will be something like reporting.crly0gpnhroz.us-east-1.rds.amazonaws.com. The port will also be in the output (3306). You can use this dns name and port to connect to the database using any mysql client.

December 6th, 2009 at 11:02 am
Vaibhav – This is excellent post for people to learn Amazon Web services’ newest RDS offering. Could you please expand on setting paths for ignorant people such as me in a different post or in this one?
September 12th, 2010 at 1:40 am
Buy:Cozaar.Buspar.Female Cialis.Wellbutrin SR.Lipitor.Lasix.Seroquel.Aricept.Prozac.Female Pink Viagra.Acomplia.Amoxicillin.Advair.Nymphomax.SleepWell.Zetia.Zocor.Ventolin.Lipothin.Benicar….