0

I need to create a shorter name for my Mysql database endpoint to be accessed from linux box. Clearly said, my mysql end point is rdsbench.c2wfqsdsqd.us-east-1.rds.amazonaws.com and I would like to create a shorter name, let's say mybenchdb, so I could use:

mysql -hmybenchdb 

instead of:

mysql -hrdsbench.c2wfqsdsqd.us-east-1.rds.amazonaws.com.

EDIT: actually I'm using percona toolkit to benchmark rds and compare it to mysql hosted on ec2. The command line is as follows:

pt-upgrade mysql-slow.log.1 h=host1 h=rdsbench.c2wffzqsdsqs.us-east-1.rds.amazonaws.com

so what I would like to do is shorten the rds endpoint I'm passing as parameter for this command.

  • Why not just use the IP address? – John Gardeniers Aug 12 '12 at 6:20
  • @JohnGardeniers AWS RDSes can change IPs, without warning. – ceejayoz Dec 15 '12 at 3:24
  • I'm trying to do the sam thing and I can't find a way, did you find something? Sorry for not comenting, I don't have enough reputation. – Jordi Casals Jul 19 '14 at 23:27
2

You can setup a local DNS server to resolve it to a shorter name. If you are connecting from a bash shell, you could also do,

$ export mybenchdb="rdsbench.c2wfqsdsqd.us-east-1.rds.amazonaws.com"
$ mysql -h$mybenchdb

Add the export to .profile or .bash_profile and it should be permanent.

|improve this answer|||||
  • It should work with this: export mybenchdb="rdsbench.c2wfqsdsqd.us-east-1.rds.amazonaws.com" pt-upgrade mysql-slow.log.1 h=host1 h=$mybenchdb – Frederik Nielsen Aug 10 '12 at 11:19
  • that's exactly what I did, but the problem is that the mysql endpoint is showing in pt-upgrade results – PapelPincel Aug 10 '12 at 11:37
  • 2
    Adding an entry to the hosts file or setting a search base in the hosts.conf is probably more sensible than trying to modify the DNS server - you'll break other stuff if you claim to have authoritative records for a domain you don't really control. – symcbean Aug 10 '12 at 11:39
  • @symcbean Except on AWS RDS, the IP of your RDS can change on its own. – ceejayoz Dec 15 '12 at 3:25
2

This is how I solved this problem:

  1. Get the public IP address of RDS endpoint

    $ nslookup rdsbench.c2dddddddx.us-east-1.rds.amazonaws.com
    Address: 10.271.12.X
    
  2. Add this IP address along with your favourite alias name to /etc/hosts file

    10.271.12.X  mybenchdb
    
|improve this answer|||||
  • 1
    AWS RDSes can change IPs, without warning. – ceejayoz Dec 15 '12 at 3:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.