【问题标题】:S3 file availability and permitsS3 文件可用性和许可
【发布时间】:2015-06-28 15:06:20
【问题描述】:

我希望存储在 S3 存储桶中的文件仅供位于 EC2 实例上的特定 Web 应用程序的用户使用。

这是回答here,但它会导致链接被删除...

也解释了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/*"]}
      }
    }
  ]
}

我该怎么做?

【问题讨论】:

    标签: amazon-ec2 amazon-s3 tomcat7 vaadin


    【解决方案1】:

    你上面的代码是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/*"]
    

    只能从您指定的网址访问存储桶。

    【讨论】:

    • 感谢您的帮助@WisdmLabs ...我创建了一个用户“user1”和一个授予对特定存储桶访问权限的策略(当我选择存储桶时会自动创建“策略文档”代码) .然后我将策略附加给用户...我尝试通过查找策略为我的存储桶创建额外的许可,但我无法从那里找到它...是这样吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-17
    相关资源
    最近更新 更多