In this section, you will configure the necessary infrastructure for specialized routing: create the ColdBrewExpressQueue on Amazon SQS, grant permission for Amazon SNS to publish messages via an SQS Access Policy, subscribe the queue to the CoffeeOrders topic, and establish a multi-attribute filter policy combining string prefix matching (prefix) and numeric comparison (numeric).
ColdBrewExpressQueue in Amazon SQS
ColdBrewExpressQueue.
<YOUR_ACCOUNT_ID> with your 12-digit AWS Account ID):{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "sns.amazonaws.com"
},
"Action": "sqs:SendMessage",
"Resource": "arn:aws:sqs:ap-southeast-1:<YOUR_ACCOUNT_ID>:ColdBrewExpressQueue",
"Condition": {
"ArnEquals": {
"aws:SourceArn": "arn:aws:sns:ap-southeast-1:<YOUR_ACCOUNT_ID>:CoffeeOrders"
}
}
}
]
}



CoffeeOrders SNS TopicColdBrewExpressQueue, switch to the SNS subscriptions tab.CoffeeOrders topic.


CoffeeOrders.ColdBrewExpressQueue.

{
"drink": [
{ "prefix": "Citrus" }
],
"quantity": [
{
"numeric": [ ">=", 2 ]
}
]
}

Multi-Attribute AND Logic:
When you define multiple distinct attribute keys at the top level of a Filter Policy (drink and quantity), Amazon SNS automatically combines them using a boolean AND operator. Both the specified drink name prefix and the numeric threshold must match simultaneously for the message to be delivered!

