我正在尝试使用 cdk 创建自定义资源以向存储桶添加库存配置,我正在调用 putBucketInventoryConfiguration() - https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#putBucketInventoryConfiguration-property 但我正在获得目标存储桶的拒绝访问策略-
config_inventory_role.add_to_policy(iam.PolicyStatement(
effect=iam.Effect.ALLOW,
resources=[f'{config_inventory_bucket.bucket_arn}/*'],
actions=['s3:PutObject'],
conditions={"ArnLike": {
"aws:SourceArn": config_upload_bucket.bucket_arn
},
"StringEquals": {
"aws:SourceAccount": [
kwargs["env"]["aws"]["account"]
],
"s3:x-amz-acl": "bucket-owner-full-control"
}
}
))
(iotsysteminventoryc231de866a82512a9a84151e276042845F52818C) Failed to create resource. Access Denied
[2020-06-15T08:23:51.589Z] new CustomResource (/tmp/jsii-kernel-ymFU82/node_modules/@aws-cdk/core/lib/custom-resource.js:23:25)
[2020-06-15T08:23:51.589Z] \_ new AwsCustomResource (/tmp/jsii-kernel-ymFU82/node_modules/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.js:130:31)
[2020-06-15T08:23:51.589Z] \_ /usr/local/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7853:49
[2020-06-15T08:23:51.589Z] \_ Kernel._wrapSandboxCode (/usr/local/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:8313:20)
[2020-06-15T08:23:51.589Z] \_ Kernel._create (/usr/local/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7853:26)
[2020-06-15T08:23:51.589Z] \_ Kernel.create (/usr/local/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7600:21)
[2020-06-15T08:23:51.589Z] \_ KernelHost.processRequest (/usr/local/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7388:28)
[2020-06-15T08:23:51.589Z] \_ KernelHost.run (/usr/local/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7328:14)
[2020-06-15T08:23:51.589Z] \_ Immediate._onImmediate (/usr/local/lib/python3.8/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7331:37)
[2020-06-15T08:23:51.589Z] \_ processImmediate (internal/timers.js:439:21)