How do you set up dynamic cname records?

view story

http://serverfault.com – The project I'm working on requires that we mask AWS EC2 host names with our own subdomains. For example: ec2-176-34-163-40.eu-west-1.compute.amazonaws.com would map to gf53ef.domain.com and ec2-123-31-124-60.eu-west-1.compute.amazonaws.com would map to sdfrh5.domain.com There will always be list available that stores the relationship between the domains. This list changes ALL THE TIME. Meaning in one minute we could have 100+ new ec2 instances started, and the next all could terminate. I'm wondering how to set up our Ubuntu server to handle this case. Thanks (HowTos)