Skip to content

SNS Public Action

0

Am defining SNS public Action in Access policy in JSON format. While defining below json script am facing issue. When i define Condition with ARN of Source bucket. Am getting below error

error code: invalidparameter - error message: an error occurred while setting the attribute access policy. invalid parameter: policy error: null

{ "Sid": "awssnowpipebucket_publish", "Effect": "Allow", "Principal": { "Service": "s3.amazonaws.com" }, "Action": "SNS:Publish" , "Resource":"arn:aws:sns:ap-southeast-1:406745342818:snowpipe_topic", "Condition": { "Arnlike": { "aws:SourceArn": "arn:aws:s3:::awssnowpipebuket" } }
}

2 Answers
0

Try setting it up with the following access policy.
That error occurred because the required section was not listed in the access policy.

{ 
    "Statement": [
        {
            "Sid": "awssnowpipebucket_publish", 
            "Effect": "Allow", 
            "Principal": { 
                "Service": "s3.amazonaws.com" 
            }, 
            "Action": "sns:Publish" , 
            "Resource":"arn:aws:sns:ap-southeast-1:406745342818:snowpipe_topic", 
            "Condition": { 
                "ArnLike": { 
                    "aws:SourceArn": "arn:aws:s3:::awssnowpipebuket" 
                } 
            }
        }
    ]
}
EXPERT

answered 3 years ago

  • { "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:ap-southeast-1:406745342818:snowpipe_topic", "Condition": { "StringEquals": { "AWS:SourceOwner": "406745342818" } } }, { "Sid": "awssnowpipebucket_publish", "Effect": "Allow", "Principal": { "Service": "s3.amazonaws.com" }, "Action": "SNS:Publish", "Resource": "arn:aws:sns:ap-southeast-1:406745342818:snowpipe_topic", "Condition": { "Arnlike": { "aws:SourceArn": "arn:aws:s3:::awssnowpipebuket" } } }, { "Sid": "snowpipe_sns_subscribe", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::817455922765:user/r6r90000-s" }, "Action": "sns:Subscribe", "Resource": "arn:aws:sns:ap-southeast-1:406745342818:snowpipe_topic" } ] }

0

The "Like" in "ArnLike" on line 37 was lowercased, resulting in an error.
The following access policies can be configured.

{
    "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:ap-southeast-1:406745342818:snowpipe_topic",
            "Condition": {
                "StringEquals": {
                    "AWS:SourceOwner": "406745342818"
                }
            }
        },
        {
            "Sid": "awssnowpipebucket_publish",
            "Effect": "Allow",
            "Principal": {
                "Service": "s3.amazonaws.com"
            },
            "Action": "SNS:Publish",
            "Resource": "arn:aws:sns:ap-southeast-1:406745342818:snowpipe_topic",
            "Condition": {
                "ArnLike": {
                    "aws:SourceArn": "arn:aws:s3:::awssnowpipebuket"
                }
            }
        },
        {
            "Sid": "snowpipe_sns_subscribe",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::817455922765:user/r6r90000-s"
            },
            "Action": "sns:Subscribe",
            "Resource": "arn:aws:sns:ap-southeast-1:406745342818:snowpipe_topic"
        }
    ]
}
EXPERT

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.