AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 813872
Accepted
Gaia
Gaia
Asked: 2016-11-09 12:10:11 +0800 CST2016-11-09 12:10:11 +0800 CST 2016-11-09 12:10:11 +0800 CST

优化 S3 策略以实现完全访问

  • 772

我制定了以下政策:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowUserToSeeBucketListInTheConsole",
            "Action": [
                "s3:GetBucketLocation",
                "s3:ListAllMyBuckets"
            ],
            "Effect": "Allow",
            "Resource": [
                "arn:aws:s3:::*"
            ]
        },
        {
            "Sid": "AllooUserFullAccessToBucket",
            "Effect": "Allow",
            "Action": [
                "s3:*"
            ],
            "Resource": [
                "arn:aws:s3:::mybucket/*"
            ]
        }
    ]
}

通过 Key/Secret(使用 Cloudberry Explorer)访问存储桶时,我可以:

  • 列出所有存储桶
  • 列出、下载、上传和删除到mybucket中,但前提是在存储桶权限上也有此权限:

在此处输入图像描述

或者

我需要在策略中添加另一个项目以取消存储桶级别权限要求:

{
    "Sid": "AllooUserFullAccessToBucketPre",
    "Effect": "Allow",
    "Action": [
        "s3:*"
    ],
    "Resource": [
        "arn:aws:s3:::mybucket"
    ]
},

是否存在允许策略中只有 2 个项目(AllowUserToSeeBucketListInTheConsole 和单个 AllooUserFullAccessToBucket)而不需要存储桶级别权限的语法?

amazon-s3 amazon-web-services
  • 2 2 个回答
  • 118 Views

2 个回答

  • Voted
  1. Best Answer
    KHobbits
    2016-11-10T06:37:41+08:002016-11-10T06:37:41+08:00

    根据我的经验,制定一项仅授予对存储桶和内容的访问权限的策略是相当标准的做法。

    我通常会使用这样的策略(不想允许此用户覆盖存储桶权限,或删除存储桶等):

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "AllowS3Browse",
                "Effect": "Allow",
                "Action": [
                    "s3:GetBucketLocation",
                    "s3:ListAllMyBuckets"
                ],
                "Resource": "*",
            },
            {
                "Sid": "GrantS3BucketAccess",
                "Effect": "Allow",
                "Action": [
                    "s3:AbortMultipartUpload",
                    "s3:DeleteObject*",
                    "s3:Get*",
                    "s3:List*",
                    "s3:PutBucketAcl",
                    "s3:PutObject",
                    "s3:PutObjectAcl",
                    "s3:RestoreObject"
                ],
                "Resource": [
                    "arn:aws:s3:::bucket",
                    "arn:aws:s3:::bucket/*"
                ]
            }        
        ]
    }
    
    • 1
  2. Anton Zorin
    2016-12-19T14:36:03+08:002016-12-19T14:36:03+08:00

    试试这个:

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": "s3:ListAllMyBuckets",
                "Resource": "arn:aws:s3:::*"
            },
            {
                "Effect": "Allow",
                "Action": "s3:*",
                "Resource": [
                    "arn:aws:s3:::mybucket",
                    "arn:aws:s3:::mybucket/*"
                ]
            },
            {
                "Effect": "Deny",
                "NotAction": "s3:*",
                "NotResource": [
                    "arn:aws:s3:::mybucket",
                    "arn:aws:s3:::mybucket/*"
                ]
            }
        ]
    }
    
    • 0

相关问题

  • 如何将 Symantec Backup Exec 与 S3 Amazon 存储结合使用?

  • Amazon S3 是否对您的数据做出任何形式的保证?

  • Amazon S3 存储如何计费?[关闭]

  • 使用亚马逊 S3 时的注意事项

  • 用于备份等的 S3 接口 [关闭]

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve