您可以使用以下 URL 格式:
https://<bucket-name>.s3.amazonaws.com/<object or key name>
或旧式:
https://s3.amazonaws.com/<bucket-name>/<object or key name>
要使其可访问,您需要允许公开访问您的对象或附加适当的存储桶策略。
例如,以下存储桶策略显示对存储桶zzzyyy
对象“yyyeee”的公共访问
$ aws s3 get-object-acl --bucket zzzyyy --key yyyeee
{
"Owner": {
"DisplayName": "owner",
"ID": "Some hash of owner"
},
"Grants": [
{
"Grantee": {
"DisplayName": "owner",
"ID": "Some hash of owner"
},
"Permission": "READ"
},
{
"Grantee": {
"DisplayName": "owner",
"ID": "Some hash of owner"
},
"Permission": "WRITE"
},
{
"Grantee": {
"DisplayName": "owner",
"ID": "Some hash of owner"
},
"Permission": "READ_ACP"
},
{
"Grantee": {
"DisplayName": "owner",
"ID": "Some hash of owner"
},
"Permission": "WRITE_ACP"
},
{
"Grantee": {
"URI": "http://acs.amazonaws.com/groups/global/AllUsers"
},
"Permission": "READ"
},
{
"Grantee": {
"URI": "http://acs.amazonaws.com/groups/global/AllUsers"
},
"Permission": "READ_ACP"
}
]
}
您可以在此处查看存储桶策略示例:
http://docs.aws.amazon.com/AmazonS3/latest/dev/AccessPolicyLanguage_UseCases_s3_a.html
您还可以使用 S3 控制台,如下所示:
