EC2 Ubuntu - Force instance to use internal IP
- by Peter
I've just set up a micro instance on EC2 (AMI ID ami-e59ca991). I had hoped to avoid charges for a year as my usage falls well within the bound of the free tier. I have been charged $0.01 for "regional data transfer". I read here that this is because my instance is talking to its self via it's external IP address.
From what I've Googled it looks like you can stop the charges by making sure that the instance uses its internal IP address. However, when I ping the hostname of my instance internally (via an ssh session) it resolves to the instances internal IP address.
How can I configure my instance so that I do not get these charges? Is it as simple as adding a line to my hosts file?
Additionally, is this the real reason for the charge? I'm concerned that I've misunderstood the pricing somewhere. I have Apace and MySQL (with phpmyadmin) running on the machine - could I be being charged for data transfer associated with these (I have only one flat HTML page and I have only logged in via phpmyadmin - I have no data in my database).
Edit:
Additionally, my user account on MySQL was declared as:
grant all privileges on *.* to 'peter'@'localhost';
Should I have instead used the internal hostname for the instance?
grant all privileges on *.* to '[email protected]';
Cheers,
Pete