简体   繁体   English

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

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

I was using Cloud9 to assume a role to test on the dynamic permission to send message to a queue.我正在使用 Cloud9 承担一个角色来测试将消息发送到队列的动态权限。

In cloud9, i assumed this role with the following permissions在 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": "*"
    }
]

} }

After assuming and verifying the right role was assumed, i use cli to send message to the queue, it succeeded with the output在假设并验证了正确的角色后,我使用 cli 将消息发送到队列,它成功了 output

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

Expected: SQS to show as 1 message received since the message sent request succeeded.预期:自消息发送请求成功以来,SQS 显示为收到 1 条消息。

What I saw instead - Number Of Messages Sent increased but no Number Of Messages Received相反,我看到的是 - 发送的消息数量增加但接收的消息数量没有增加在此处输入图像描述

But the queue shows message available但队列显示消息可用

在此处输入图像描述

My command我的命令

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...."

Question:问题:

  • I thought my action was to send a message to SQS queue from Cloud9 after assuming the right permission access, and the queue was supposed to have 'Number of Message Received' since the queue-url i specified the message to send to is the same queue.我认为我的操作是在获得正确的访问权限后从 Cloud9 向 SQS 队列发送一条消息,并且该队列应该具有“接收到的消息数”,因为我指定要发送到的消息的队列 url 是同一个队列. I am confused with why no 'number of message received' when there's message available shown.我很困惑为什么在显示可用消息时没有“收到的消息数”。
  • there is no cloudwatch logs that are able to help me to understand anything没有能够帮助我理解任何内容的 cloudwatch 日志
  • does this means that the permission actually allows the message sent but there is some issue in the queue receiving the message?这是否意味着权限实际上允许发送消息但接收消息的队列中存在一些问题? (For example access denied?) (例如拒绝访问?)

thanks in advance提前致谢

Sounds like you have sent 2 messages but haven't received (ie read from the queue) any.听起来你已经发送了 2 条消息,但还没有收到(即从队列中读取)任何消息。 Try running the following to receive a message:尝试运行以下命令以接收消息:

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

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

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