有誰知道我是否可以使用通配符并允許訪問 S3 存盤桶中的所有內容?而不是像我目前正在做的那樣明確添加每個位置?
const policyDoc = new PolicyDocument({
statements: [
new PolicyStatement({
sid: 'Grant role to read/write to S3 bucket',
resources: [
`${this.attrArn}`,
`${this.attrArn}/*`,
`${this.attrArn}/emailstore`,
`${this.attrArn}/emailstore/*`,
`${this.attrArn}/attachments`,
`${this.attrArn}/attachments/*`
],
actions: ['s3:*'],
effect: Effect.ALLOW,
principals: props.allowedArnPrincipals
})
]
});
uj5u.com熱心網友回復:
您應該能夠使用:
resources: [
`${this.attrArn}`,
`${this.attrArn}/*`
],
第一個授予對桶本身的操作(例如ListBucket)的/*權限,同時授予對桶內的操作(??例如GetObject)的權限。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/454789.html
