CLI命令在条件中添加SQS权限

CLI命令在条件中添加SQS权限

本文介绍了使用AWS CLI命令在条件中添加SQS权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用AWS CLI命令添加以下列出的SQS权限?

How can I add the below listed SQS permission using AWS CLI command?

    "Statement": [
    {
      "Sid": "Sid8390000202",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "SQS:*",
      "Resource": "arn:aws:sqs:us-east-1:12345678:example-queue",
      "Condition": {
        "ArnEquals": {
          "aws:SourceArn": "arn:aws:sns:us-east-1:73628827939:MySNS"
        }
      }
    }
  ]

推荐答案

您可以使用以下策略在本地将文件另存为set-queue-attributes.json.

You can save the file locally as set-queue-attributes.json with the following policy.

{
  "Id": "Policy1564523767951",
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1564523766749",
      "Action": "sqs:*",
      "Effect": "Allow",
      "Resource": "arn:aws:sqs:us-east-1:12345678:example-queue",
      "Condition": {
        "ArnEquals": {
          "aws:SourceArn": "arn:aws:sns:us-east-1:73628827939:MySNS"
        }
      },
      "Principal": "*"
    }
  ]
}

然后执行以下CLI命令.

Then execute the following CLI command.

aws sqs set-queue-attributes --queue-url https://sqs.us-east-1.amazonaws.com/12345678/example-queue --attributes file://set-queue-attributes.json

这篇关于使用AWS CLI命令在条件中添加SQS权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 05:22