Implement serverless queues and event-driven processing
✓Works with OpenClaudeYou are a serverless architecture specialist. The user wants to implement serverless queues and event-driven processing using AWS SQS, Lambda, and EventBridge.
What to check first
- Verify AWS CLI is installed:
aws --version - Check IAM permissions for SQS, Lambda, and EventBridge:
aws iam get-user - Confirm Node.js runtime available:
node --version
Steps
- Create an SQS queue using AWS CLI with
aws sqs create-queue --queue-name my-processing-queue --attributes VisibilityTimeout=300,MessageRetentionPeriod=1209600 - Create an IAM role for Lambda with
AWSLambdaSQSQueueExecutionRolepolicy attached - Create a Lambda function that will consume messages from the queue with handler entry point
index.handler - Configure the SQS queue as an event source mapping to Lambda using
aws lambda create-event-source-mapping --event-source-arn <queue-arn> --function-name my-processor --batch-size 10 - Set up EventBridge rule with
aws events put-rule --name my-processing-rule --event-bus-name default --state ENABLED - Add the SQS queue as the EventBridge target using
aws events put-targets --rule my-processing-rule --targets "Id"="1","Arn"="<queue-arn>" - Publish test events to EventBridge with
aws events put-events --entries file://events.json - Monitor execution with CloudWatch Logs:
aws logs tail /aws/lambda/my-processor --follow
Code
// Lambda handler for processing SQS messages
const AWS = require('aws-sdk');
const sqs = new AWS.SQS();
exports.handler = async (event) => {
console.log('Processing batch:', event.Records.length);
const results = [];
for (const record of event.Records) {
try {
const body = JSON.parse(record.body);
console.log('Message body:', body);
// Process the message
const processedData = await processMessage(body);
results.push({
messageId: record.messageId,
status: 'success',
data: processedData
});
// Delete message from queue after successful processing
await sqs.deleteMessage({
QueueUrl: process.env.QUEUE_URL,
ReceiptHandle: record.receiptHandle
}).promise();
} catch (error) {
console.error('Error processing message:', error);
results.push({
messageId: record.messageId,
status: 'failed',
error: error.message
});
// Message will be redriven to DLQ after max retries
}
}
return {
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
Related Serverless Skills
Other Claude Code skills in the same category — free to download.
Vercel Deploy
Deploy and configure applications on Vercel
Netlify Deploy
Deploy and configure applications on Netlify
SST Setup
Set up SST (Serverless Stack) for full-stack serverless apps
Serverless Framework
Configure Serverless Framework for multi-cloud deployment
Edge Functions
Build and deploy edge functions (Vercel, Cloudflare Workers)
Serverless Database
Set up serverless databases (PlanetScale, Neon, Turso)
Serverless Cron
Set up serverless cron jobs and scheduled functions
Want a Serverless 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.