hmo*_*ega 5 go amazon-web-services amazon-sns
我的团队在SNS上有一个拥有完全权限的帐户,只要我们根据某个前缀对资源进行操作
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sns:CreateTopic",
// ...
"sns:ListTopics",
// ...
],
"Resource": "arn:aws:sns:eu-west-1:{redacted}:team-prefix-*"
},
Run Code Online (Sandbox Code Playgroud)
我们可以很好地执行大多数操作,至少是我们最需要的操作,但是如果我们尝试列出主题,则会出现禁止错误
SNS: ListTopics, AuthorizationError: User xxx is not authorized to perform: SNS:ListTopics on resource: arn:aws:sns:eu-west-1:{redacted}:*
Run Code Online (Sandbox Code Playgroud)
我们正在使用新的 go SDK v2,我们找不到只查询我们的主题的方法,有没有办法列出它们,或者我们是否需要列出所有帐户主题的权限?
sns:ListTopics 没有资源过滤器(https://docs.aws.amazon.com/sns/latest/api/API_ListTopics.html),它是全有或全无操作。
亚马逊文档除外:if you specify a resource type in a statement with an action that does not support that resource type, then the statement doesn't allow access.
链接
通常,如果您希望能够列出,那么 IAM 文档应该是这样的。
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sns:CreateTopic"
],
"Resource": "arn:aws:sns:eu-west-1:{redacted}:team-prefix-*"
},
{
"Effect": "Allow",
"Action": [
"sns:ListTopics",
],
"Resource": "*"
},
...
Run Code Online (Sandbox Code Playgroud)
如果粒度级别的分离确实是一个大问题,则应使用单独的 AWS 账户。
归档时间: |
|
查看次数: |
64 次 |
最近记录: |