简体   繁体   English

将 s3 Bucket 乘以 tigger 的 aws sqs 的策略是什么

[英]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,我有 S3 存储桶,在对象放置事件中,我触发 SQS 队列并在我的实例中接收队列并处理它,

Access policy of sqs is sqs的访问策略是

{
  "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但是我没有工作,所以有人请帮我找到在两个不同的存储桶中使用相同的 sqs queqe 的访问策略是什么

Your current policy is not valid JSON.您当前的政策不是有效的 JSON。 To specify multiple ArnLike values you need to use a list:要指定多个ArnLike值,您需要使用列表:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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