Amazon RDS – The Beginner’s Guide

Sayan Chaliha

On the eve of Microsoft’s announcement of the public release of SQL Azure Database, Amazon decides to release RDS. And that, too, after having resisted users’ demands for a relational database service for a very long time. Preemptive action, perhaps? Whatever it may be, I believe that such a healthy competition can do much good to the Cloud marketplace.

RDS brings with it the promise of MySQL on a Cloud. Having been a MySQL fan for quite some time now, I was itching to get my hands on an AWS account and check out what the hype was all about. Imagine my confusion when I signed up for Amazon RDS and all the AWS Management Console showed me was the EC2 dashboard! It was time I downloaded the Getting Started Guide and went through the rigmarole of studying it.

Setting up the Command Line Interface Tools

Apparently, there is no GUI yet for RDS. The only way to go about using it is through the CLI tools. Setting up the tools, however, can be quite a pain: There are no installers per se; you have to download the archive, extract it, and set up the environment manually. Here’s how I did it on my Windows XP box:

  • Prerequisites: The CLI tools are written in Java. So you need to have either JDK or JRE installed on your system to be able to run them. I had JRE 6 installed.
  • The Environment: There are a couple of environment variables that need to be set, manually:
    • The JAVA_HOME variable, containing the path of the Java runtime installed on the system.
    • The AWS_RDS_HOME variable, containing the path to the folder containing the CLI tools.
C:\>set JAVA_HOME=E:\Java\jre6
C:\>set AWS_RDS_HOME=C:\Amazon RDS\CLI

  • The Credential File: The archive containing the CLI tools also had a file named credential-file-path.template. I copied my AWS Access and Secret Keys into the place holders in the file, and then had to set yet another environment variable:
C:\>set AWS_CREDENTIAL_FILE=C:\Amazon RDS\CLI\credential-file-path.template
  • One Last Thing: Finally, I was almost done (setting up the CLI tools, that is)! All I had to do was add the path of the CLI tools to the PATH variable:
C:\>set PATH=%PATH%;C:\Amazon RDS\CLI

Creating a Database Instance

I went on to create an Extra Large database instance, with an allocated storage of 5GB:

C:\>rds-create-db-instance --engine MySQL5.1 --master-username root --master-user-password mypass
--db-name WebyogTestData --db-instance-identifier webyogtestinstance --allocated-storage 5
--db-instance-class db.m1.xlarge –-header
DBINSTANCE  DBInstanceId        Class         Engine    Storage  Master Username
Status    Backup Retention
DBINSTANCE  webyogtestinstance  db.m1.xlarge  mysql5.1  5        root
creating  1
SECGROUP  Name     Status
SECGROUP  default  active
PARAMGRP  Group Name        Apply Status
PARAMGRP  default.mysql5.1  in-sync
C:\>

The rds-decribe-db-instances command displays all the running instances:

C:\>rds-describe-db-instances
DBINSTANCE  webyogtestinstance  2009-11-06T08:40:52.571Z  db.m1.xlarge  mysql5.1
5   root  available  webyogtestinstance.clc2ed76md1v.us-east-1.rds.amazonaws.com 3306  us-east-1d  1
SECGROUP  default  active
PARAMGRP  default.mysql5.1  in-sync
C:\>

Voila! My database is up and running in no time.

Setting up SQLyog/MONyog to Connect to Amazon RDS

Here’s the best part about Amazon RDS: It has native MySQL 5.1 support. (Well, at this time, it supports  no other RDBMS, but may be  it will in the future.) This means that I can use my favorite MySQL GUI tool to connect to the Amazon RDS database instance. Or at least that’s what Amazon claims.

SQLyog Settings for RDS
SQLyog settings for RDS

I filled in the master user name and password that I had used to create the DB instance. For the host address, I used webyogtestinstance.clc2ed76md1v.us-east-1.rds.amazonaws.com (I noticed it in the output of the rds-describe-db-instances command).

Apprehensively, I clicked on the Test Connection button and without a hitch it connected successfully. Notice that SQLyog reports as having connected to MySQL 5.1.38-log.

Success connecting to Amazon RDS
Success connecting to Amazon RDS

Setting up MONyog was as simple.

MONyog displaying Amazon RDS DB stats
MONyog displaying Amazon RDS DB stats

MONyog displaying the InnoDB Cache stats

MONyog displaying the InnoDB Cache stats

In Conclusion

RDS is but a MySQL 5.1 instance running on an EC2 platform, bringing with it all the advantages of EC2. You can scale your server to use up to 68GB of memory, 26 ECUs, and 1TB of persistent storage. On the flip-side, Amazon RDS does not support replication yet.

Periodically, the Amazon RDS system performs some maintenance of the database instance. This ensures that your server is running smoothly. This also translates into a 4-hour down time period on a weekly basis. Within a weekly 4-hour user-definable window (the maintenance window) Amazon’s management system may start back-ups or roll out patches for the MySQL server. This may, however, result in a certain amount of downtime of your DB instance.

There is a pattern emerging here, if you look close enough. Back in 2008, at about the same time, when it became clear that Microsoft would announce a Windows-based Cloud, Amazon jumped in and announced support for Windows-based EC2 instances. And Amazon has managed to do it again with RDS. Microsoft, it seems, drives Amazon harder than users do.

For us at Webyog this is an exciting development. We believe that our products (SQLyog and MONyog) are very well ‘fit for the Cloud’.  Much more fit than the console-based tools that most advanced users still seem to use.  We will now start checking our programs in detail with this. Till now we’ve found no issues.

Want to Know More?

Read more about Amazon RDS froom their website.

Amazon RDS Functionality.

Pricing plans for Amazon RDS.

Sign up for Amazon RDS.


Comments

  1. November 7th, 2009 | 5:36 pm
  2. November 9th, 2009 | 4:30 am

    this is pretty exciting, im gonna go check it out myself. thx for the great article!

  3. Sayan Chaliha
    November 9th, 2009 | 7:19 am

    Hey Josh,

    Glad that you liked the article. Do come back and check this blog later… We’re going to be doing a series of posts on Amazon RDS.

  4. grig
    November 11th, 2009 | 11:26 pm

    “Periodically, the Amazon RDS system performs some maintenance of the database instance. This ensures that your server is running smoothly. This also translates into a 4-hour down time period on a weekly basis.”

    What? That’s a deal breaker for me. I haven’t read anything like this in the docs yet. Can you point me to your reference?

    Thanks!

  5. November 12th, 2009 | 3:21 am

    Hmmm.. I got an error connecting on my first DB instance.

    There’s a need to authorize access to the db instance unless is not the first DB instance in RDS you got. :)

  6. Sayan Chaliha
    November 12th, 2009 | 5:03 am

    Hi Grig,
    Funnily enough, the “Getting Started Guide” doesn’t mention anything about maintenance. However, try the “Developer’s Guide” (page 8): There’s a short and precise paragraph on maintenance. Also, the “Command Line Interface Reference” includes several allusions to “maintenance windows” and how to change the default window.

  7. Sayan Chaliha
    November 12th, 2009 | 5:10 am

    Hey Rodney,

    You are absolutely correct. You have to set up access permissions for different users, and host IPs. In my opinion, these stringent security measures are very much needed. More so because the only way you can access your DB instance is through the Internet.

  8. Sayan Chaliha
    November 15th, 2009 | 3:04 pm

    Grig,

    I’ve made a mistake in my blog post with the maintenance window issue. It does NOT necessarily mean that you’ll have a 4-hour downtime period every week. I’ve made a correction to the post as well…

  9. November 16th, 2009 | 9:46 am

    [...] on the server. For example, we created an extra large instance just of the purpose of the previous blog post. We only connected for a few minutes to test it but the server was idle for 99% of the time. At the [...]

  10. January 6th, 2010 | 1:19 am

    [...] are that your applications will work seamlessly with Amazon RDS as well. For instance, in one of my previous posts, I had described how to set up SQLyog and MONyog for an Amazon RDS DB instance. SQL Azure features [...]

Leave a reply