Skip to content

SQS ABAC not working with aws:ResourceTag

0

Hi,

I'm trying to conditionally deny sqs:SendMessage on an SQS queue based on a resource tag.

My goal is to “suspend” a queue by adding a tag like suspend=true, and have a resource-based queue policy deny SendMessage when that tag is present.

Here is the queue policy I'm trying to apply:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Deny",
      "Principal": "*",
      "Action": "sqs:SendMessage",
      "Resource": "arn:aws:sqs:us-east-2:123456789012:TestQueue",
      "Condition": {
        "StringEquals": {
          "aws:ResourceTag/suspend": "true"
        }
      }
    }
  ]
}

When I apply this policy (via CDK / SetQueueAttributes and via the console), I get the following error:

InvalidParameterValueException: Value aws:ResourceTag/suspend for parameter Condition is invalid.
Reason: Conditions must be from Global context key list

However, according to the Service Authorization Reference for SQS, [aws:ResourceTag/${TagKey} appears to be a valid condition key for SQS]resources(https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonsqs.html#amazonsqs-policy-keys:~:text=String-,aws%3AResourceTag/%24%7BTagKey%7D,-Filters%20access%20by)

My questions:

Is aws:ResourceTag/... supported in SQS resource-based queue policies? If not, it seems that the documentation is misleading. What is the recommended way to implement a “temporary suspension” of SendMessage without deleting/recreating the queue?

For context:

  • The queue is in a single AWS account
  • The tag exists on the queue
  • ABAC for SQS is supported in this region (us-east-2)
  • The policy is attached directly to the queue

Thanks in advance for any clarification.

1 Answer
0
Accepted Answer

Hello.

The "Condition keys" column for the "SendMessage" action does not include "aws:ResourceTag/${TagKey}", so I don't think it can be used as a condition key.
a

EXPERT

answered 9 months ago

AWS
EXPERT

reviewed 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.