列出 AWS SNS 主题中的待定订阅

List Pending Subscriptions in AWS SNS topic

我已经通过多个电子邮件订阅了 SNS,但有几封电子邮件是错误的,我看到状态为“待确认”。我正在寻找一个命令来列出只有 PendingConfirmation subscriptedARns 的订阅数组。

通过使用以下命令,我获得了所有订阅列表,但我只需要待定确认订阅: aws sns list-subscriptions-by-topic --topic-arn arn:aws:sns:us-east-1:xxxxx:qwertyuuyt

{
    "Subscriptions": [
        {
            "SubscriptionArn": "arn:aws:sns:us-east-1:xxxxxxx:qwertyuuyt:ccffgv-e904-4f68-9a8f-vvggbb",
            "Owner": "xxxxxxx",
            "Protocol": "email",
            "Endpoint": "qwerty@amazon.com",
            "TopicArn": "arn:aws:sns:us-east-1:xxxxxxx:qwertyuuyt"
        },
        {
            "SubscriptionArn": "PendingConfirmation",
            "Owner": "xxxxxxx",
            "Protocol": "email",
            "Endpoint": "qwer@amazo.com",
            "TopicArn": "arn:aws:sns:us-east-1:xxxxxxx:qwertyuuyt"
        },
        {
            "SubscriptionArn": "PendingConfirmation",
            "Owner": "xxxxxxx",
            "Protocol": "email",
            "Endpoint": "qwettet@amazn.com",
            "TopicArn": "arn:aws:sns:us-east-1:xxxxxxx:qwertyuuyt"
        }`cv`
    ]
}

您应该可以使用以下 --query:

aws sns list-subscriptions-by-topic --topic-arn arn:aws:sns:us-east-1:xxxxx:qwertyuuyt --query "Subscriptions[?SubscriptionArn=='PendingConfirmation']"