S3 文件可用性和许可
S3 file availability and permits
我希望存储在 S3 存储桶中的文件仅供位于 EC2 实例上的特定 Web 应用程序的用户使用。
已回答 here,但会导致删除 link...
也有解释here,但我不知道如何实现解决方案...我应该在某处包含这段代码:
{
"Version":"2012-10-17",
"Id":"http referer policy example",
"Statement":[
{
"Sid":"Allow get requests originated from www.example.com and example.com",
"Effect":"Allow",
"Principal":"*",
"Action":"s3:GetObject",
"Resource":"arn:aws:s3:::examplebucket/*",
"Condition":{
"StringLike":{"aws:Referer":["http://www.example.com/*","http://example.com/*"]}
}
}
]
}
我该怎么做?
你上面的代码是aws安全策略.....
您需要做以下事情:
Step1: Create a IAM user from AWS Dashboard -> Users -> Create New Users.
Step2: Create a policy for your bucket from AWS Dashboard -> Policies -> Get Started -> Create Policy.
Step3: Attach the policy created in Step2 to the user created in step1.
现在您的存储桶将只能由您使用指定策略创建的用户访问。
因为您的保单有一条规则
"aws:Referer":["http://www.example.com/*","http://example.com/*"]
只能从您指定的 url 访问存储桶。
我希望存储在 S3 存储桶中的文件仅供位于 EC2 实例上的特定 Web 应用程序的用户使用。
已回答 here,但会导致删除 link...
也有解释here,但我不知道如何实现解决方案...我应该在某处包含这段代码:
{
"Version":"2012-10-17",
"Id":"http referer policy example",
"Statement":[
{
"Sid":"Allow get requests originated from www.example.com and example.com",
"Effect":"Allow",
"Principal":"*",
"Action":"s3:GetObject",
"Resource":"arn:aws:s3:::examplebucket/*",
"Condition":{
"StringLike":{"aws:Referer":["http://www.example.com/*","http://example.com/*"]}
}
}
]
}
我该怎么做?
你上面的代码是aws安全策略.....
您需要做以下事情:
Step1: Create a IAM user from AWS Dashboard -> Users -> Create New Users.
Step2: Create a policy for your bucket from AWS Dashboard -> Policies -> Get Started -> Create Policy.
Step3: Attach the policy created in Step2 to the user created in step1.
现在您的存储桶将只能由您使用指定策略创建的用户访问。
因为您的保单有一条规则
"aws:Referer":["http://www.example.com/*","http://example.com/*"]
只能从您指定的 url 访问存储桶。