[英]When using Public-Accessible S3 buckets, how are there not collisions with other Public-Accessible S3 bucket and object names?
I have an S3 bucket my-bucket
and an object in that bucket my-image.jpg
我有一个S3存储桶
my-bucket
和该my-bucket
一个对象my-image.jpg
In order to display these images in a website, directly out of S3, I've put this bucket policy on my-bucket
: 为了在S3之外的网站上直接显示这些图像,我已将此存储桶策略放在
my-bucket
:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-bucket/*"
}
]
}
Now, in my website, I can conveniently just do this in my HTML: 现在,在我的网站上,我可以方便地在HTML中执行此操作:
<img width="400" height="400"
src="https://s3.amazonaws.com/my-bucket/my-image.jpg">
But what is stopping someone, somewhere, from making their own public my-bucket
, and adding a my-image.jpg
? 但是,是什么阻止某人在某个地方公开自己的“
my-bucket
”并添加my-image.jpg
呢? How will it load the proper image? 如何加载正确的图像? Does S3 handle this in some way?
S3是否以某种方式处理此问题?
note No, these are not the actual bucket names + image names. 注意不,这些不是实际的存储桶名称+图像名称。 They are examples.
他们是例子。
from http://docs.aws.amazon.com/AmazonS3/latest/gsg/CreatingABucket.html 来自http://docs.aws.amazon.com/AmazonS3/latest/gsg/CreatingABucket.html
"The bucket name you choose must be unique across all existing bucket names in Amazon S3." “您选择的存储桶名称在Amazon S3中所有现有存储桶名称中必须是唯一的。”
so amazon won't let you have a naming collision in the first place. 因此,亚马逊一开始不会让您发生命名冲突。
I think that is now per region, since regions get their own domain, but I am not sure. 我认为现在是每个区域,因为区域拥有自己的域,但是我不确定。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.