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.

3
  • Why not just use the IP address? Aug 12, 2012 at 6:20
  • @JohnGardeniers AWS RDSes can change IPs, without warning.
    – ceejayoz
    Dec 15, 2012 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. Jul 19, 2014 at 23:27

2 Answers 2

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.

4
  • 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
    Aug 10, 2012 at 11:19
  • that's exactly what I did, but the problem is that the mysql endpoint is showing in pt-upgrade results Aug 10, 2012 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, 2012 at 11:39
  • @symcbean Except on AWS RDS, the IP of your RDS can change on its own.
    – ceejayoz
    Dec 15, 2012 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
    
1
  • 2
    AWS RDSes can change IPs, without warning.
    – ceejayoz
    Dec 15, 2012 at 3:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .