Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I know it's possible to have a subdomain point to an s3 bucket (so, I could use something like s3.example.com). Is it possible to use wildcard DNS with S3 (or something like it) to do the following?

  • abc.example.com => /abc.example.com/
  • 123.example.com => /123.example.com/
  • 123.example.com/test.png => /123.example.com/test.png

I'm assuming this isn't possible with S3; I can use any similar service. It just needs to be able to serve static files.

(Note: I'm making a file host, where people can sign up for their-subdomain.my-host-domain.com. The host would just serve static files from their subdomain on my domain.)

share|improve this question
    
Honestly I am not sure what exactly you mean with abc.example.com => /abc.example.com/ ? –  golja Jul 11 '12 at 2:57
    
Edited for clarity –  Gregory Jul 11 '12 at 3:28

2 Answers 2

I'm assuming that you would create separate S3 buckets for each subdomain. You would need your DNS server to have a wildcard record, but where the requested name is prepended to the response. For example, the following domains would be dynamically generated:

abc.example.com.    CNAME   abc.example.com.s3.amazonaws.com.
123.example.com.    CNAME   123.example.com.s3.amazonaws.com.

I don't however know of any DNS servers which have this functionality.

share|improve this answer
    
S3 normally has a limit of 100 buckets per account. So not really suitable if you have an unbounded number of subdomains. –  Alan Christensen Oct 31 '13 at 7:31

S3 requires the bucket to exist in the first place... so without a bit of work, the short answer is that it can't be done out of the box.

To do it though.. 1. When a user signs up - use the AWSSDK to create an s3 bucket with the slug at the front... (ie - company.example.com) 2. Configure the bucket using the AWSSDK to allow static file hosting 3. Add a record to Route53 as an alias from company.example.com to the appropriate s3 bucket.

Then you've got to configure all the permissions issues as well - who can access etc - using IAM and s3 policies. Fair bit of work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.