Menu
First look: Amazon RDS gives you a MySQL server in the cloud

First look: Amazon RDS gives you a MySQL server in the cloud

Amazon's Relational Database Service provides an easy escalator into the cloud for existing MySQL applications

Amazon's Relational Database Service (RDS) creates a MySQL database server in the cloud. The notion of "database as a service" is already a reality, thanks to products like FathomDB. Amazon itself provides EC2 instances running MySQL, and Amazon's SimpleDB service offers capabilities similar -- but not identical -- to Amazon RDS.

So why RDS? In particular, why choose RDS over SimpleDB?

SimpleDB's very name gives the best reason. SimpleDB is intended to be used as a simple database. SimpleDB stores tuples -- attributes and values -- arranged as rows identified by an ID field. It's excellent if you need basic read, write, and query capabilities. It is not, however, a relational database.

Very well, you say, then what of an instance of EC2 running MySQL? Doesn't that provide the same functionality as RDS? True, but RDS pares the components to their MySQL essentials. Unlike an EC2 instance, RDS requires no operating system configuration or management. Neither do you have to work out the details of connecting your EC2 instance to EBS (Elastic Block Storage), nor worry over issues of backing up the EBS holding your database.

Put simply, if a MySQL database is all you want, RDS is just that -- nothing more, nothing less. It's that last part -- nothing less -- that's the real power of RDS.

Instant DB Instance From a user's (and developer's) perspective, Amazon RDS is no more than a remote MySQL database. Amazon refers to a specific instantiation of an RDS-based MySQL server as a DB Instance. Amazon provides a Web-service based API for creating and managing DB Instances; the rest can be handled by standard MySQL communication protocols.

When a DB Instance is created, you specify the attributes that govern its behavior and capacity. For example, a DB Instance's Class determines the server's available memory and processing power. (Amazon specifies processing power using a metric called an Elastic Compute Unit, or ECU, roughly equivalent to a 1.0GHz 2007 Xeon processor.) The list of instance classes reads like a fast food menu. Start with a Small DB Instance at 1.7GB of memory and one ECU, work your way up to a Large instance, then an Extra Large instance, a Double Extra Large instance, and top out at the gut-busting Quadruple Extra Large instance that boasts 68GB of memory and 26 ECUs.

Another attribute defined at DB Instance creation time is the available storage, which can range from 5GB to 1,024GB. While Amazon RDS tops out at 1TB databases, that limitation applies to a single DB Instance. Nothing stops you from partitioning your data into multiple DB Instances; effectively, then, the upper limit -- other than your pocketbook -- is 1TB per table.

When you create a DB Instance, you can also define its backup window. This is a time interval within a 24-hour period during which (if specified) Amazon will automatically back up your database. Associated with the backup window parameter is the retention period parameter, which specifies how many days Amazon retains the backup. (Currently, backups can be retained for up to eight days.)

Finally, if you'd rather not depend on daily, automated backups, you can request a database snapshot at any time. And since each snapshot is associated with a unique identifier, you can create a series of snapshots and restore the database to a specific past state. Of course, storage of snapshot data is not a free service.

Working with RDS To use Amazon RDS, you need two things: the command-line tools and a MySQL-compatible client application. The former is provided by Amazon as a set of Java applications, downloadable from the Amazon Web Services site. They handle the management of DB Instances -- creating, adjusting the parameters, deleting, and so on. The latter can be any application that communicates with a MySQL server. Of course, you also need an AWS Access ID and associated AWS Secret Access Key, both of which you receive when you sign up for Amazon Web Services.

Once you've downloaded the command-line tools, you set a pair of environment variables. One points to a file containing your AWS access key ID and secret key ID. The other holds the command-line tools' path. That done, you can create a small instance (1 ECU and 20GB of storage) using a command like:

rds-create-db-instance --db-instance-identifier rginstance --allocated-storage 20 ---db-instance-class db.m1.small --enging MySQL5.1 --master-username rgrehan --master-user-password mypassword --db-name ADBTest --headers

In this case, rds-create-db-instance is one of the command-line tools.

This produces a DB Instance identified as rginstance, whose administrator's login name is rgrehan and password is mypassword. In addition, a database named ADBTest will be created within the instance and have a maximum storage allotment of 20GB.

To connect a client application to the new database, you need its host path. You can get it with the help of the rds-describe-db-instances command, which returns information for DB Instances associated with your account, including each instance's path. If you don't want information for all your account's DB Instances, you can issue rds-describe-db-instances with a specific instance as an argument.

Finally, you have to grant access to the DB Instance to client applications. Do that with the rds-authorize-db-security-group-ingress command, passing it the CIDR-format range of IP addresses that you want to permit into your database. If you have security groups defined for Amazon EC2 instances, you can use those in place of the IP address ranges. RDS will only permit connections from clients in the security group.

From that point on, working with RDS is like working with any MySQL server. Any application or tool that can talk to MySQL can talk to your RDS DB Instance. You can even use the standard MySQL command-line monitor tool to create users and tables, issue SQL commands, and so on. The only restriction is that RDS disallows SUPER privileges, though RDS provides a specialized form of the MySQL "kill" command to fill the hole created by SUPER's absence. (See the RDS documentation for details.)

Join the CIO Australia group on LinkedIn. The group is open to CIOs, IT Directors, COOs, CTOs and senior IT managers.

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags cloud computingserversmysqlAmazon RDS

More about Amazon Web ServicesC2Hewlett-Packard AustraliaHPMySQL

Show Comments
[]