从其他用户访问 SNS 主题

Accessing SNS topic from other user

我正在评估 SNS 主题的安全性,我注意到它具有以下配置:

{
    "Action": [
      "SNS:Receive",
      "SNS:Subscribe"
    ],
    "Principal": {
      "AWS": "*"
    },
    "Resource": "arn:aws:sns:us-east-1:topicowner:topic",
    "Effect": "Allow",
    "Sid": "__console_sub_0"
}

我不是主题所有者,但是,鉴于它允许匿名访问(或至少对任何 AWS 帐户进行身份验证访问),我假设我可以使用以下 CLI 命令订阅它:

aws sns subscribe --topic-arn "arn:aws:sns:us-east-1:topicowner:topic" --protocol email --notification-endpoint my-email@example.com

(我使用我的 AWS 访问密钥和秘密对其进行了配置)

但我得到了以下错误:

An error occurred (InvalidParameter) when calling the Subscribe operation: Invalid parameter: TopicArn

我假设错了吗?还有什么我应该尝试的吗?

主题 arn 似乎无效,缺少 AWS Account id。正确的语法是:

arn:aws:sns:region:account-id:topicname

只是为了更正,当你说 given the fact it allows for anonymous access。这不是真的,Principal 通配符表示 AWS 账户中的所有用户而不是任何匿名用户。

也尝试添加区域‘—region us-east-1’