我在账户 A 下设置了一个 Kinesis Firehose 流。根据我们的要求,该流应将数据写入不同 AWS 账户 B 拥有的 s3 存储桶,其中涉及:
- 该 s3 存储桶应出现在关联的 Firehose 设置的下拉列表中,
- 该 firehose 流应具有对给定 s3 存储桶的写入权限。
到目前为止,我已将以下策略添加到帐户 B (id 2) 下的 s3 存储桶中,我想从帐户 A (id 1) 下的 firehose 写入该策略。
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "avs-bi-access",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::1:root"
]
},
"Action": [
"s3:ListBucket",
"s3:GetObject",
“s3:PutObject”
],
"Resource": [
"arn:aws:s3:::testBucket",
"arn:aws:s3:::testBucket/*"
]
}
]
}
除此之外,账户A(id 1)下Firehose使用的角色中,信任关系如下:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "firehose.amazonaws.com",
"AWS": "arn:aws:iam::2:root"
},
"Action": "sts:AssumeRole"
}
]
}
即使在那之后,我也无法在 Firehose 配置页面中选择给定的存储桶。我想,我错过了一些东西。
最佳答案
您应该遵循以下说明:
基本上:
- 您的 S3 策略应有一个指向 Firehose 使用的 IAM 角色的委托(delegate)人
- 示例在角色主体中未包含
AWS
值
您将永远从控制台的下拉列表中显示的其他帐户获取存储桶。相反,您需要在通过 API/CLI 调用创建 Firehose Delivery Stream 时选择存储桶,或者您可以使用 update-destination
用于更改目的地的 API 调用:
aws firehose update-destination --delivery-stream-name foo --current-delivery-stream-version-id 1 --destination-id 'destinationId-000000000001' --extended-s3-destination-update '{"BucketARN":"arn:aws:s3:::YOUR-BUCKET"}'
您可以通过以下方式获取版本
和destination-id
:
aws firehose describe-delivery-stream --delivery-stream-name foo
免责声明:我尝试了上述所有方法并设法选择了存储桶。但是,我没有收到任何传送到存储桶的数据。也许你会比我更成功。
关于amazon-web-services - 设置一个aws账户拥有的s3对另一个aws账户拥有的firehose流的写访问权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50673807/