Amazon MQ: How to Migrate On-Premises Message Brokers to AWS
Amazon MQ ActiveMQ/RabbitMQ engines, differences from SQS/SNS, migration scenarios and SAA-C03 exam essentials explained.
Related Exam Domains
- Domain 3: Design High-Performing Architectures
Key Takeaway
Amazon MQ is a managed message broker supporting Apache ActiveMQ and RabbitMQ. Use it to migrate existing applications to AWS without code changes. For new applications, SQS/SNS is recommended.
Exam Tip
Exam Essential: "JMS, AMQP, MQTT protocols required" → Amazon MQ, "New application + unlimited scaling" → SQS/SNS, "Migrate on-premises ActiveMQ" → Amazon MQ
When Should You Use Amazon MQ?
Best For
Amazon MQ Recommended Scenarios:
├── On-premises message broker migration
│ └── Existing systems using ActiveMQ, RabbitMQ
├── Standard protocols required
│ └── JMS, AMQP, MQTT, STOMP, OpenWire
├── Minimize existing code changes
│ └── Change only endpoints, keep protocols
└── Bidirectional communication needed
└── Request-response patterns, temporary queues
Not Ideal For
Cases Where Amazon MQ Isn't the Best Fit:
├── New cloud-native applications
│ → Use SQS/SNS (simpler, more scalable)
├── Unlimited scaling required
│ → SQS (virtually unlimited throughput)
├── Serverless architecture
│ → SQS + Lambda combination
└── Simple Pub/Sub patterns
→ Use SNS
Amazon MQ Engine Comparison
ActiveMQ vs RabbitMQ
┌─────────────────────────────────────────────────────────────┐
│ Amazon MQ Engine Comparison │
├──────────────────────────┬──────────────────────────────────┤
│ ActiveMQ │ RabbitMQ │
├──────────────────────────┼──────────────────────────────────┤
│ │ │
│ Protocols: │ Protocols: │
│ • JMS (Java standard) │ • AMQP 0-9-1 │
│ • AMQP 1.0 │ • MQTT │
│ • MQTT │ • STOMP │
│ • STOMP │ │
│ • OpenWire │ │
│ │ │
│ Features: │ Features: │
│ • Java ecosystem │ • Multi-language support │
│ • Enterprise features │ • Flexible routing │
│ • Complex routing │ • Easy cluster scaling │
│ │ │
│ Deployment: │ Deployment: │
│ • Single-instance │ • Single-instance │
│ • Active/Standby │ • Cluster (3 nodes) │
│ • Network of brokers │ │
│ │ │
└──────────────────────────┴──────────────────────────────────┘
When to Choose Which Engine?
| Scenario | Recommended Engine |
|---|---|
| Java/JMS-based legacy apps | ActiveMQ |
| Multi-language clients | RabbitMQ |
| Complex message routing | ActiveMQ |
| Cluster high availability | RabbitMQ |
| AMQP 0-9-1 protocol needed | RabbitMQ |
Amazon MQ vs SQS/SNS
Comparison Table
| Aspect | Amazon MQ | SQS | SNS |
|---|---|---|---|
| Type | Managed broker | Message queue | Pub/Sub |
| Protocols | JMS, AMQP, MQTT | AWS API | AWS API |
| Scalability | Broker size limited | Virtually unlimited | Virtually unlimited |
| Management | Broker instance mgmt | Fully serverless | Fully serverless |
| Pricing | Instance + storage | Per request | Per publish |
| Migration | Minimal code changes | Code rewrite needed | Code rewrite needed |
Selection Flow
Messaging Service Selection:
│
▼
Migrating existing on-premises message broker?
│
Yes → Which protocols in use?
│ │
│ JMS, AMQP, MQTT → [Amazon MQ]
│ │
│ AWS API possible → [Consider SQS/SNS redesign]
│
No
│
▼
Building new cloud-native application?
│
Yes → What message pattern?
│ │
│ Point-to-Point (1:1) → [SQS]
│ │
│ Pub/Sub (1:N) → [SNS]
│ │
│ Event routing → [EventBridge]
│
No → [Choose based on requirements]
Exam Tip
Key Exam Phrase: "Migrate existing application without code changes" → Amazon MQ is the answer!
Amazon MQ Architecture
High Availability Deployment
┌─────────────────────────────────────────────────────────────┐
│ Amazon MQ Active/Standby (ActiveMQ) │
├─────────────────────────────────────────────────────────────┤
│ │
│ [Client Applications] │
│ │ │
│ ▼ │
│ ┌─────────────────────┐ │
│ │ Wire-level Endpoint │ │
│ │ (Failover URL) │ │
│ └─────────────────────┘ │
│ │ │
│ ┌──────┴──────┐ │
│ ▼ ▼ │
│ ┌────────┐ ┌────────┐ │
│ │ Active │ │Standby │ │
│ │ Broker │ │ Broker │ │
│ │ (AZ-a) │ │ (AZ-b) │ │
│ └────────┘ └────────┘ │
│ │ │ │
│ └──────┬──────┘ │
│ ▼ │
│ ┌─────────────────────┐ │
│ │ Amazon EFS │ ← Shared message store │
│ │ (Shared Storage) │ │
│ └─────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
Pricing Structure
Pricing Components (US East)
| Item | ActiveMQ | RabbitMQ |
|---|---|---|
| mq.t3.micro | $0.027/hour | $0.027/hour |
| mq.m5.large | $0.182/hour | $0.182/hour |
| Storage | $0.10/GB/month | $0.10/GB/month |
| Data Transfer | Standard EC2 rates | Standard EC2 rates |
Cost Optimization Tips
Cost Reduction Strategies:
├── Dev/Test environments
│ └── Single-instance, small instance types
├── Production environments
│ └── Provision only required capacity
├── New projects
│ └── Start with SQS/SNS (no instance costs)
└── Post-migration
└── Consider gradual transition to SQS/SNS
SAA-C03 Exam Focus Points
Commonly Tested Scenarios
- ✅ Migration: "On-premises ActiveMQ → AWS" → Amazon MQ
- ✅ Protocol Requirements: "JMS, AMQP needed" → Amazon MQ
- ✅ New vs Legacy Apps: New → SQS/SNS, Legacy → Amazon MQ
- ✅ Scalability Requirements: "Unlimited scaling" → SQS (not Amazon MQ)
- ✅ Minimize Code Changes: "No application modifications" → Amazon MQ
Sample Exam Questions
Exam Tip
Sample Exam Question 1: "A company uses Apache ActiveMQ on-premises and wants to migrate to AWS. They want to minimize application code changes. What should they use?"
→ Answer: Amazon MQ (ActiveMQ engine) (existing JMS code works without changes)
Exam Tip
Sample Exam Question 2: "A new serverless application needs message queuing. Which service should be used?"
→ Answer: Amazon SQS (serverless, unlimited scaling, Lambda integration)
Exam Tip
Sample Exam Question 3: "IoT devices using MQTT protocol need message processing. How can existing MQTT client code be preserved?"
→ Answer: Amazon MQ (RabbitMQ engine) or AWS IoT Core (native MQTT support)
Frequently Asked Questions
Q: What's the difference between Amazon MQ and AWS IoT Core?
Amazon MQ is a general-purpose message broker, while AWS IoT Core is IoT device-specific. Use IoT Core if you need device management, device shadows, and rules engine.
Q: Can I migrate from Amazon MQ to SQS?
Yes, but code changes are required. You'll need to change JMS API to AWS SDK, AMQP to HTTP API. You can run both systems in parallel for gradual migration.
Q: How long are messages retained in Amazon MQ?
Both ActiveMQ and RabbitMQ support persistent storage. Messages remain in broker storage until consumed. This differs from SQS's maximum 14-day retention.
Q: Can I change broker size?
Yes, but downtime occurs. With Active/Standby deployment, downtime can be minimized through failover. Proper initial sizing is important.
Q: Is Amazon MQ accessible only within VPC?
Amazon MQ supports both public access and private access. For security, it's recommended to deploy in private VPC subnets and access via VPN/Direct Connect.
Related Posts
- SQS vs SNS vs EventBridge Comparison
- Step Functions Workflow Orchestration
- Kinesis Real-Time Streaming