Skip to main content

Claude/ChatGPT Prompt to Design Event-Driven Architecture with SQS/SNS

Design event-driven systems with AWS SQS, SNS, and EventBridge - message patterns, dead letter queues, and exactly-once processing.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt
Design an event-driven architecture for e-commerce order processing pipeline using AWS messaging services. 1) Event taxonomy: define OrderPlaced, PaymentProcessed, InventoryReserved, ShipmentCreated, OrderCompleted with schema structure (event name, version, payload, metadata) following CloudEvents v1.0. 2) SNS topics: create topics for order-events, payment-events, inventory-events, notification-events with message filtering policies that route events to the correct subscribers. 3) SQS queues: configure queues for payment-service, inventory-service, notification-service, analytics-service with visibility timeout 60 seconds (6x the Lambda timeout), message retention of 14 days, and proper redrive policies. 4) Dead letter queues: set up DLQs with 5 max receives, create a Lambda function that processes DLQ messages with alerting to PagerDuty via SNS, with a Slack mirror for visibility. 5) Ordering and deduplication: configure FIFO queues for payment and inventory events for the same order with message group IDs based on message group ID set to the order ID. 6) EventBridge: set up an event bus with rules that match high-value orders and failed payments for fraud review and route to multiple targets. 7) Idempotency: implement exactly-once processing using DynamoDB idempotency table with event ID as partition key to handle message redelivery. 8) Monitoring: create CloudWatch dashboards for queue depth, age of oldest message, and DLQ message count with alarms.

What this prompt does

This prompt designs an event-driven architecture on AWS messaging services for a given [application_type]. It defines an event taxonomy for [event_types] using a [schema_standard], sets up SNS topics for [topic_categories] with filtering, configures SQS queues for [consumer_services] with a [visibility_timeout] and [retention_period], and wires EventBridge rules to match [event_patterns]. The whole flow is built so events fan out cleanly and consumers process independently.

The structure works because it makes the model design the parts engineers skip under time pressure. It forces dead-letter queues with a [max_receive_count] plus a Lambda that processes DLQ messages and alerts [alert_channel], FIFO queues for [ordered_events] grouped by [grouping_strategy], and exactly-once processing via [idempotency_strategy]. A redelivered message corrupting state is the failure mode I least want to debug in production, so making idempotency and DLQ handling explicit is the point of the prompt.

When to use it

  • A system has outgrown synchronous calls and needs decoupled, retry-safe messaging
  • You are building a pipeline like order processing where [event_types] must flow between independent services
  • You need SNS-to-SQS fan-out with filtering so [consumer_services] receive only relevant events
  • You want dead-letter handling designed properly, with a [max_receive_count] and DLQ processing
  • Certain [ordered_events] require FIFO ordering and deduplication keyed by [grouping_strategy]
  • You need idempotent consumers so message redelivery never corrupts state

Example output

Expect an architecture spec: an event-schema definition for your event types, SNS topic and filter-policy configuration, SQS queue settings with visibility timeout and retention, a DLQ design with a processing Lambda and alerting, FIFO configuration for ordered events, EventBridge rules for your patterns, an idempotency implementation, and CloudWatch dashboards for queue depth, oldest-message age, and DLQ counts.

Pro tips

  • Set [visibility_timeout] relative to your consumer's processing time — the default of roughly six times the Lambda timeout prevents premature redelivery while work is still in flight
  • Define [event_types] with versioning from day one; adding a version field now saves painful schema migrations later
  • Choose [grouping_strategy] carefully for FIFO — grouping by order ID preserves per-order ordering while still allowing parallelism across different orders
  • Make [idempotency_strategy] concrete, such as a DynamoDB table keyed on event ID, because exactly-once is really at-least-once delivery plus deduplication you implement
  • Set [max_receive_count] so genuinely poisoned messages land in the DLQ instead of looping forever, and actually wire the DLQ alert to [alert_channel]
  • Validate the design against your real throughput; the model proposes settings, but queue depth and retention need tuning under your actual load
  • Use SNS message filtering on [topic_categories] so each consumer subscribes only to events it cares about, rather than filtering in application code after delivery
  • Set the DLQ processing Lambda to capture enough context — original payload, error, and receive count — so a message in [alert_channel] is actually debuggable
  • Watch the CloudWatch oldest-message-age metric closely, since a steadily rising value signals a consumer falling behind before queue depth makes it obvious

Frequently Asked Questions

Does this prompt cover exactly-once message processing?
It designs for it through the `[idempotency_strategy]` you specify, such as a DynamoDB idempotency table keyed on event ID. AWS messaging is fundamentally at-least-once, so true exactly-once comes from your consumers deduplicating redelivered messages. The prompt makes that deduplication an explicit design step rather than an afterthought.
When should I use FIFO queues versus standard queues?
Use FIFO only for `[ordered_events]` that genuinely require strict ordering, like payment and inventory events for the same order, grouped by your `[grouping_strategy]`. Standard queues offer higher throughput and lower cost, so reserve FIFO for the specific flows where out-of-order processing would cause incorrect results.
How does it handle messages that keep failing?
It configures dead-letter queues with a `[max_receive_count]`, so a message that fails that many times moves to the DLQ instead of looping. The prompt also designs a Lambda to process DLQ messages and alert your `[alert_channel]`, so poison messages are surfaced rather than silently lost.
Will the queue settings it suggests work for my traffic volume?
Treat them as informed defaults, not final values. Settings like `[visibility_timeout]` and `[retention_period]` depend on your real processing time and throughput. Start with the prompt's recommendations, then tune them by watching queue depth and oldest-message-age metrics under your actual load before considering the design finished.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in AWS & Cloud Architecture Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

AI assistant · trained on my work

👋

Hey there!

Quick Actions

WhatsApp Direct line to me

Chat on WhatsApp

+880 1723 741224 · Replies within the hour on working days

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

mejba.13@gmail.com

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support