将多个子域映射到同一S3桶 [英] Map multiple subdomains to same S3-bucket

查看:204
本文介绍了将多个子域映射到同一S3桶的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将多个(数千个)子域映射到一个s3桶?
如果是这样,还可以将其映射到每个子域的桶中的特定路径?



我想要test1.example.com映射到mybucket / test1和test2.example.com映射到mybucket / test2。



我知道最后一部分是不可能与正常的dns记录,但也许有一些漂亮路线53功能?

解决方案

S3不可能直接。您只能在S3桶中使用1个子域。



但是,您可以将多个子域映射到 Cloudfront 发行。



更新(感谢@SimonHutchison的评论



您现在可以将多达100个备用域映射到Cloudfront
发行版 - 请参阅 http://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html#limits_cloudfront



您还可以使用通配符将任何子域映射到您的发行版:


使用*替代域名通配符



添加时替代域名,您可以使用域名
开头的*通配符,而不是单独指定子域
。例如,替换域名为
* .example.com,您可以在对象网址中使用任何以example.com结尾的域名,例如www.example.com,
product- name.example.com和marketing.product-name.example.com。对于
的名称,不论域名如何,对于
示例:



www.example。 com / images / image.jpg



product-name.example.com/images/image.jpg



marketing.product-name.example.com/images/image.jpg



Is there some way to map multiple (thousands) of subdomains to one s3-bucket? If so is it also possible to map it to a specific path in the bucket for each subdomain?

I want test1.example.com to map to mybucket/test1 and test2.example.com to map to mybucket/test2.

I know the last part isn't possible with normal dns-records but maybe there is some nifty Route 53 feature?

解决方案

It's not possible with S3 directly. You can only use 1 subdomain with an S3 bucket.

However you can map multiple subdomains to a Cloudfront distribution.

Update (thanks to @SimonHutchison's comment below)

You can now map up to 100 alternate domains to a Cloudfront distribution - see http://docs.aws.amazon.com/general/latest/gr/aws_service_limits.html#limits_cloudfront

You can also use a wildcard to map any subdomain to your distribution:

Using the * Wildcard in Alternate Domain Names

When you add alternate domain names, you can use the * wildcard at the beginning of a domain name instead of specifying subdomains individually. For example, with an alternate domain name of *.example.com, you can use any domain name that ends with example.com in your object URLs, such as www.example.com, product-name.example.com, and marketing.product-name.example.com. The name of an object is the same regardless of the domain name, for example:

www.example.com/images/image.jpg

product-name.example.com/images/image.jpg

marketing.product-name.example.com/images/image.jpg

这篇关于将多个子域映射到同一S3桶的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆