测试从具有发送/接收消息权限到队列但未收到消息的 Cloud9 角色发送 SQS 消息

Test sending SQS message from role in Cloud9 having send / received message permission to queue but no message received

我正在使用 Cloud9 担任角色以测试向队列发送消息的动态权限。

在 cloud9 中,我使用以下权限担任此角色

{
"Version": "2012-10-17",
"Statement": [
    {
        "Sid": "VisualEditor0",
        "Effect": "Allow",
        "Action": [
            "sqs:DeleteMessage",
            "sqs:ReceiveMessage",
            "sqs:SendMessage",
            "sqs:GetQueueAttributes"
        ],
        "Resource": [
            "arn:aws:sqs:us-west-2:{accountID}:general-queue-abc",
            "arn:aws:sqs:eu-west-2:{accountID}:individual-queue-${insert-attribute-by-customer-name}"
        ]
    },
    {
        "Sid": "VisualEditor1",
        "Effect": "Allow",
        "Action": "sqs:ListQueues",
        "Resource": "*"
    }
]

}

假设并验证了正确的角色后,我使用 cli 将消息发送到队列,输出成功

{
"MD5OfMessageBody": "dummyNumbers",
"MessageId": "dummyNumbers" }

预期:自消息发送请求成功以来,SQS 显示收到 1 条消息。

我看到的是 - 发送的消息数量增加但接收的消息数量没有增加

但是队列显示消息可用

我的命令

aws sqs send-message --queue-url https://sqs.{REGION}.amazonaws.com/{AccountID}/individual-queue-{insert-attribute-by-customer-name} --message-body "I am sending a new message...."

问题:

提前致谢

听起来你已经发送了 2 条消息,但还没有收到(即从队列中读取)任何消息。尝试运行以下方式来接收消息:

aws sqs receive-message --queue-url https://sqs.{REGION}.amazonaws.com/{AccountID}/individual-queue-{insert-attribute-by-customer-name}