简体   繁体   中英

What will the policy of aws sqs which is tigger by multiply s3 Bucket

I have S3 bucket and on object-put event I trigger SQS queue and received queue in my instance and process it,

Access policy of sqs is

{
  "Version": "2012-10-17",
  "Id": "arn:aws:sqs:ca-central-1:xxxxxxxxxxxx:abcd",
  "Statement": [
    {
      "Sid": "example-statement-ID",
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      },
      "Action": "SQS:SendMessage",
      "Resource": "arn:aws:sqs:ca-central-1:xxxxxxxxxxxx:abcd",
      "Condition": {
        "ArnLike": {
          "aws:SourceArn": "arn:aws:s3:::<bucket name>"
        }
      }
    }
  ]
}

It's working fine for me but now I want to use the same queue in a two different bucket, I tried policy

{
  "Version": "2012-10-17",
  "Id": "arn:aws:sqs:ca-central-1:xxxxxxxxxxxx:abcd",
  "Statement": [
    {
      "Sid": "example-statement-ID",
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      },
      "Action": "SQS:SendMessage",
      "Resource": "arn:aws:sqs:ca-central-1:xxxxxxxxxxxx:abcd",
      "Condition": {
        "ArnLike": {
          "aws:SourceArn": "arn:aws:s3:::<bucket name>",
          "aws:SourceArn": "arn:aws:s3:::<bucket name2>"
        }
      }
    }
  ]
}

But I didn't work, So anybody please help me to find what will be the Access policy of using same sqs queqe in two different bucket

Your current policy is not valid JSON. To specify multiple ArnLike values you need to use a list:

    "ArnLike": {
      "aws:SourceArn": ["arn:aws:s3:::<bucket name>",
             "arn:aws:s3:::<bucket name2>"]
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM