Lab Goal
You will build this flow:
SNS Topic (publisher) → SQS Queue (subscriber) → receive message
Why this matters:
- SNS = “broadcast / publish” messages
- SQS = “store messages safely until processed”
- Together = decoupled microservices (production pattern)
Step-by-step Lab (Console)
Step 0: Open AWS Console
- Login to AWS Console
- Make sure you are in a region (example: us-east-2 Ohio)
- Top-right corner → choose region
Part A — Create SNS Topic
Step 1: Open SNS
- In AWS Console search bar, type: SNS
- Click Simple Notification Service
Step 2: Create a Topic
- Left menu → click Topics
- Click Create topic
Step 3: Configure Topic
- Type: select Standard
-
Name:
devops-sns-topic - Scroll down (leave defaults)
- Click Create topic
Step 4: Copy the Topic ARN
- After creation, you will be inside the topic page
- Find ARN (looks like
arn:aws:sns:...) - Copy it and save it in notes:
SNS_TOPIC_ARN = ...
Part B — Create SQS Queue
Step 5: Open SQS
- In AWS Console search bar, type: SQS
- Click Simple Queue Service
Step 6: Create Queue
- Click Create queue
Step 7: Configure Queue
- Type: select Standard
-
Name:
devops-sqs-queue - Leave the defaults for beginner lab
- Scroll down → click Create queue
Step 8: Copy Queue ARN + Queue URL
- Open your queue: click
devops-sqs-queue - Copy and save:
-
ARN (save as
SQS_QUEUE_ARN = ...) -
URL (save as
SQS_QUEUE_URL = ...)
Part C — Subscribe SQS to SNS
Step 9: Go back to SNS Topic
- Search SNS again (or open from services)
- Click Topics
- Click
devops-sns-topic
Step 10: Create Subscription
- Scroll to Subscriptions
- Click Create subscription
Step 11: Subscription settings
- Topic ARN should already be filled
- Protocol: choose Amazon SQS
- Endpoint: paste your SQS queue ARN
- paste
SQS_QUEUE_ARN- Click Create subscription
Part D — Allow SNS to send messages into SQS (VERY IMPORTANT)
If you skip this, messages often won’t arrive.
Step 12: Open SQS queue permissions
- Go to SQS
- Click Queues
- Click
devops-sqs-queue
Step 13: Edit Access Policy
- Go to Access policy (or “Permissions” tab)
- Click Edit
- You will see a policy JSON box
Step 14: Paste policy (and replace values)
Paste this policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Allow-SNS-SendMessage",
"Effect": "Allow",
"Principal": { "Service": "sns.amazonaws.com" },
"Action": "sqs:SendMessage",
"Resource": "SQS_QUEUE_ARN",
"Condition": {
"ArnEquals": {
"aws:SourceArn": "SNS_TOPIC_ARN"
}
}
}
]
}
Now replace:
-
SQS_QUEUE_ARN→ your real queue ARN -
SNS_TOPIC_ARN→ your real topic ARN
Click Save changes
Part E — Publish a message to SNS
Step 15: Go to SNS Topic again
- Open SNS
- Topics → click
devops-sns-topic
Step 16: Publish message
- Click Publish message
-
Subject (optional):
test-message - Message body:
Hello students!
SNS published this message.
SQS will store it until consumer reads it.
- Click Publish message
Part F — Receive the message from SQS
Step 17: Open queue to read messages
- Open SQS
- Click
devops-sqs-queue
Step 18: Poll for messages
- Click Send and receive messages
- Click Poll for messages
- You should see the message appear
Step 19: View message body
- Click the message
- Expand details
- You will see SNS wrapped the message (normal behavior)
Step 20: Delete message
- Select the message checkbox
- Click Delete
- Confirm delete
What should learn
SNS (Topic)
- “I send 1 message”
- “Many systems can receive it”
- Like: announcements to many subscribers
SQS (Queue)
- “I store messages safely”
- “Consumer reads later”
- Prevents loss if consumer is down
Together
- Producer and consumer do not depend on each other
- More reliable and scalable systems
Common mistakes (quick troubleshooting)
1) No messages arrive in SQS
Check:
- Did you add SQS access policy allowing SNS?
- Did you paste the correct topic ARN in the policy?
- Are SNS + SQS in the same AWS region?
2) Subscription looks fine but still nothing
- Re-open subscription → confirm it’s using correct queue ARN
- Re-publish message
Cleanup (optional but good practice)
- Delete subscription (SNS topic → Subscriptions → delete)
- Delete SNS topic
- Delete SQS queue
SOCIAL SHARE CARD GENERATOR