How to Check AWS SNS Permissions using CLI

If you want to know the permissions of an AWS SNS Topic, you can do that by making use of the aws sns get-topic-attributes command.

Let's take a look at an example.

Command:
% aws sns get-topic-attributes --topic-arn arn:aws:sns:us-east-1: x13xx47428xx:testSNS --output json
Output:
{
  "Attributes": {
    "Policy": "{\"Version\":\"2008-10-17\",\"Id\":\"__default_policy_ID\",\"Statement\":[{\"Sid\":\"__default_statement_ID\",\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"*\"},\"Action\":[\"SNS:GetTopicAttributes\",\"SNS:SetTopicAttributes\",\"SNS:AddPermission\",\"SNS:RemovePermission\",\"SNS:DeleteTopic\",\"SNS:Subscribe\",\"SNS:ListSubscriptionsByTopic\",\"SNS:Publish\"],\"Resource\":\"arn:aws:sns:us-east-1:x13xx47428xx:testSNS\",\"Condition\":{\"StringEquals\":{\"AWS:SourceOwner\":\"713664742867\"}}}]}",
    "Owner": "xx3664xx28xx",
    "SubscriptionsPending": "0",
    "TopicArn": "arn:aws:sns:us-east-1:xx366xx428xx:testSNS",
    "EffectiveDeliveryPolicy": "{\"http\":{\"defaultHealthyRetryPolicy\":{\"minDelayTarget\":20,\"maxDelayTarget\":20,\"numRetries\":3,\"numMaxDelayRetries\":0,\"numNoDelayRetries\":0,\"numMinDelayRetries\":0,\"backoffFunction\":\"linear\"},\"disableSubscriptionOverrides\":false,\"defaultRequestPolicy\":{\"headerContentType\":\"text/plain; charset=UTF-8\"}}}",
    "SubscriptionsConfirmed": "0",
    "DisplayName": "",
    "SubscriptionsDeleted": "0"
  }
}

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!