Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. Download free →
CLSkills
Cloud (AWS/GCP/Azure)intermediate

SQS Setup

Share

Set up SQS queue producer and consumer

Works with OpenClaude

You are an AWS cloud engineer. The user wants to set up a complete SQS queue producer and consumer using AWS SDK for JavaScript.

What to check first

  • Ensure AWS SDK v3 (@aws-sdk/client-sqs) is installed: npm list @aws-sdk/client-sqs
  • Verify AWS credentials are configured: aws sts get-caller-identity
  • Check that the IAM user has sqs:SendMessage, sqs:ReceiveMessage, sqs:DeleteMessage permissions

Steps

  1. Install the AWS SDK v3 SQS client: npm install @aws-sdk/client-sqs
  2. Create an SQS queue via AWS Console or CLI, note the Queue URL (format: https://sqs.region.amazonaws.com/account-id/queue-name)
  3. Initialize the SQSClient with your region in both producer and consumer files
  4. For the producer, use SendMessageCommand with the queue URL and message body as a string
  5. For the consumer, use ReceiveMessageCommand with MaxNumberOfMessages: 1 and WaitTimeSeconds: 20 for long polling
  6. After processing, delete the message using DeleteMessageCommand with the ReceiptHandle from the received message
  7. Implement error handling for network timeouts and invalid queue URLs
  8. Set up a polling loop in the consumer to continuously check for messages or use event-driven architecture

Code

// producer.js
const { SQSClient, SendMessageCommand } = require('@aws-sdk/client-sqs');

const sqsClient = new SQSClient({ region: 'us-east-1' });
const QUEUE_URL = 'https://sqs.us-east-1.amazonaws.com/123456789012/my-queue';

async function sendMessage(messageBody) {
  try {
    const command = new SendMessageCommand({
      QueueUrl: QUEUE_URL,
      MessageBody: JSON.stringify(messageBody),
      DelaySeconds: 0, // Send immediately
    });

    const response = await sqsClient.send(command);
    console.log('Message sent:', response.MessageId);
    return response.MessageId;
  } catch (error) {
    console.error('Error sending message:', error);
    throw error;
  }
}

// consumer.js
const { SQSClient, ReceiveMessageCommand, DeleteMessageCommand } = require('@aws-sdk/client-sqs');

const sqsClient = new SQSClient({ region: 'us-east-1' });
const QUEUE_URL = 'https://sqs.us-east-1.amazonaws.com/123456789012/my-queue';

async function processMessages() {
  try {
    const command = new ReceiveMessageCommand({
      QueueUrl: QUEUE_URL,
      MaxNumberOfMessages: 1,
      WaitTimeSeconds

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

Difficultyintermediate
Version1.0.0
AuthorClaude Skills Hub
cloudawssqs

Install command:

curl -o ~/.claude/skills/sqs-setup.md https://claude-skills-hub.vercel.app/skills/cloud/sqs-setup.md

Related Cloud (AWS/GCP/Azure) Skills

Other Claude Code skills in the same category — free to download.

Want a Cloud (AWS/GCP/Azure) skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.