【问题标题】:Granting AWS Config access to the Amazon S3 Bucket授予 AWS Config 对 Amazon S3 存储桶的访问权限
【发布时间】:2021-06-14 21:58:48
【问题描述】:

我想为 Amazon S3 存储桶创建 AWS Config 访问权限,下面提供了我根据链接 https://docs.aws.amazon.com/config/latest/developerguide/s3-bucket-policy.html 编写的策略:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AWSConfigBucketPermissionsCheck",
      "Effect": "Allow",
      "Principal": {
        "Service": [
         "config.amazonaws.com"
        ]
      },
      "Action": "s3:GetBucketAcl",
      "Resource": "arn:aws:s3:::targetBucketName"
    },
    {
      "Sid": "AWSConfigBucketExistenceCheck",
      "Effect": "Allow",
      "Principal": {
        "Service": [
          "config.amazonaws.com"
        ]
      },
      "Action": "s3:ListBucket",
      "Resource": "arn:aws:s3:::targetBucketName"
    },
    {
      "Sid": "AWSConfigBucketDelivery",
      "Effect": "Allow",
      "Principal": {
        "Service": [
         "config.amazonaws.com"    
        ]
      },
      "Action": "s3:PutObject",
      "Resource": "arn:aws:s3:::targetBucketName/[optional] prefix/AWSLogs/sourceAccountID-WithoutHyphens/Config/*",
      "Condition": { 
        "StringEquals": { 
          "s3:x-amz-acl": "bucket-owner-full-control"
        }
      }
    }
  ]
}   

我想了解下面提供的部分:

"Resource": "arn:aws:s3:::targetBucketName/[optional] prefix/AWSLogs/sourceAccountID-WithoutHyphens/Config/*",

prefix 的含义是什么?如何填写政策中的prefix/AWSLogs/sourceAccountID-WithoutHyphens/Config/* 部分?

谢谢。

【问题讨论】:

    标签: amazon-web-services amazon-s3 aws-policies


    【解决方案1】:

    前缀是您在配置日志记录到 S3 时定义的。这是可选的。 Config 使用标准路径/密钥格式将日志写入 S3 存储桶,即“prefix/AWSLogs/sourceAccountID-WithoutHyphens/Config/*”。

    如果您从控制台将配置日志记录配置到 S3,您不必担心存储桶策略,因为它会自动创建。您只需提供存储桶名称和可选前缀。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-22
      • 2017-11-01
      • 2016-09-05
      • 2017-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-17
      相关资源
      最近更新 更多