What's best practice for communication between Amazon EC2 instances?
Solution 1:
Check out Eric Hammond's article explaining how to use Elastic IP addresses even from within EC2. This method does NOT result in any bandwidth charges because resolving the Elastic IP address (by name) from within EC2 returns the Private IP address.
http://alestic.com/2009/06/ec2-elastic-ip-internal
For more options, I have an article examining a few alternatives:
http://shlomoswidler.com/2010/06/track-changes-to-your-dynamic-cloud-services-automatically.html
Solution 2:
Deploy your EC2 instance into an AWS Virtual Private Cloud (VPC). When you configure your VPC you will assign CIDR to all the EC2 instances in the VPC and the internal IP will be static.
Solution 3:
- Most secure communication method
SSH is a very good method for transferring data between different servers but if you're looking for something like a permanent connection (to a database for example) you can use any kind of encrypted tunneling software like stunnel
- Non static private IPs
Since there's no way to have static private IPs you can use some kind of automatic server deployment for this, there's several tools like mcollective, capistrano or func that'll allow you to register your new instance to a central designated server and generate actions on multiple machines based on that