I'm using amazon RDS and amazon EC2.
For amazon EC2 I've configurated load balancer, and I'm going to use autoscalling in future.
I'd like to create user in my RDS Mysql instance, that can access to mysql only from specific DNS.
For example: I've domain 'test.com' which is CNAME for loadbalancer DNS. When I'm creating user in mysql 'test-user'@'test.com' and trying to connect from my EC2 instance I have an error message: Access denined for user 'test-user'@'Private ip of my ec2 instance here'.
So I can't use ip address in mysql, because I'm going to use autoscalling, and amazon will create new instances with unknown ip, and mysql didn't resolve hostname of my instance.
Do you have any ideas?
Updated: answer for @Frédéric Henri question "do you have security group on your RDS instance ?"
Yes of course, I have security group. But it's not suitable in this case, because with security group I can allow to connect to the database only from instances inside my VPC. I need to give access to the database to another guy, but I'd like to create user which has readonly access (only select)