I have 2 Linux servers on AWS. Both servers are in the default vpc (aws default vpc). Both of these servers have their own Elastic IP. I also have a webServer which is inside the same vpc.

I want to run a replicated MySQL on these 2 servers, so one server would be master and the other slave.

I need to provide an ip address for each MySQL server, so in my.cnf, there is a setting: bind-address

Should I use the public or private IP for the bind-address? (All the computers who need access to MySQL server are in the same vpc).

Note both servers are in the same Security Group and I have opened all the ports within the security group.

  • 3
    You'd want to use the internal IPs for this. – ceejayoz May 15 '19 at 23:40
  • What made you think the external addresses would possibly be preferable? – womble May 16 '19 at 2:20
  • I am just a programmer... it's the first time that I working with Networks/Subnets/VPC etc... I thought it has to be the private ip, but wasn't sure. – Hooman Bahreini May 16 '19 at 2:23

You should use internal IP addresses for your instances to talk to each other. If you use their public or elastic IP addresses, you are charged for in-region network data transfer. There is no charge for using the private IP addresses.

| improve this answer | |
  • This is correct, except that there is a charge for private IPv4 address traffic from one availability zone to another within the same VPC (and within the same AZ for traffic crossing a VPC peering connection). – Michael - sqlbot May 16 '19 at 2:25
  • True, but the charge is less than the charge for using the elastic IP. – Michael Hampton May 16 '19 at 3:25

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.