I have a firewalled server (in this case, Redis, but this probably isn't central to my question.) I want to lock down access to only certain IP addresses -- a variable, changing set of worker Amazon EC2 instances. The catch is that I don't know the IP addresses up front. What are some good approaches to manage this?
2012-08-31 Update: the Redis server is not running on EC2. If it was, I could use Amazon Security Groups.
2012-09-20 Update: See also this question from 2008: How can I programmatically manage iptables rules on the fly?. I'm looking for updated approaches, work-arounds, or whatever. Currently, I'm using some hand-made scripts that generate rules from template files -- I'd be surprised if there is not something better out there.
2012-09-21 Update: I'm running Ubuntu 12. I'm using Amazon Elastic IP's. Currently, I'm regenerating the iptables config using an ERB template and reloading via a remote script. I was hoping to, at least, find an API for iptables -- or, better yet, a tool to help.