Messaging & Streaming
Amazon MQ
Managed ActiveMQ/RabbitMQ, Migration từ on-premises
Tổng quan
Amazon MQ là managed message broker service hỗ trợ Apache ActiveMQ và RabbitMQ. Dành cho việc migrate từ on-premises messaging systems sang AWS mà không cần thay đổi code.
Khi nào dùng Amazon MQ vs SQS/SNS?
| Scenario | Recommend |
|---|---|
| New cloud-native app | SQS + SNS |
| Migrate existing apps using standard protocols | Amazon MQ |
| Need AMQP, MQTT, STOMP, OpenWire | Amazon MQ |
| Serverless, auto-scaling | SQS + SNS |
| Maximum throughput, unlimited scale | SQS + SNS |
- Broker Engines
- Architecture
- Deployment Modes
- Protocols & Features
- Security
- So sánh SQS/SNS vs Amazon MQ
- Best Practices
1. Broker Engines
1.1 Apache ActiveMQ
1.2 RabbitMQ
1.3 ActiveMQ vs RabbitMQ
| Feature | ActiveMQ | RabbitMQ |
|---|---|---|
| Protocols | OpenWire, STOMP, AMQP, MQTT | AMQP 0-9-1 |
| Routing | Basic | Advanced (Exchanges) |
| HA Storage | EFS (shared) | Cluster replication |
| Management UI | Web console | Management plugin |
| Use Case | JMS-based Java apps | Modern microservices |
2. Architecture
2.1 Single-Instance Broker
2.2 Active/Standby Broker (ActiveMQ)
2.3 Cluster Deployment (RabbitMQ)
3. Deployment Modes
| Mode | Engine | Use Case | HA |
|---|---|---|---|
| Single-Instance | ActiveMQ, RabbitMQ | Dev/Test | ❌ |
| Active/Standby | ActiveMQ only | Production HA | ✅ |
| Cluster | RabbitMQ only | Production HA | ✅ |
Network Accessibility
4. Protocols & Features
4.1 Supported Protocols
| Protocol | Description | Port |
|---|---|---|
| OpenWire | Native ActiveMQ protocol | 61617 |
| AMQP 1.0 | Advanced Message Queuing Protocol | 5671 |
| STOMP | Simple Text Oriented Messaging | 61614 |
| MQTT | IoT messaging protocol | 8883 |
| WebSocket | Browser-based clients | 61619 |
4.2 Message Patterns
5. Security
5.1 Authentication & Authorization
6. So sánh SQS/SNS vs Amazon MQ
6.1 Bảng so sánh
| Feature | SQS/SNS | Amazon MQ |
|---|---|---|
| Type | Cloud-native | Managed broker |
| Protocol | AWS APIs | AMQP, MQTT, STOMP, OpenWire |
| Scaling | Unlimited, auto | Limited by instance |
| Management | Serverless | Manage instances |
| Migration | New apps | Lift-and-shift |
| Cost | Pay per message | Pay per instance hour |
| Features | Basic | Rich (routing, transactions) |
| HA | Built-in | Configure Active/Standby |
6.2 Decision Tree
7. Best Practices
7.1 When to use Amazon MQ
| Use Case | Recommendation |
|---|---|
| Migrate from on-prem ActiveMQ/RabbitMQ | ✅ Amazon MQ |
| Need JMS compatibility | ✅ Amazon MQ (ActiveMQ) |
| Need AMQP/MQTT protocols | ✅ Amazon MQ |
| New serverless application | ❌ Use SQS/SNS |
| Need unlimited scale | ❌ Use SQS/SNS |
7.2 Production Recommendations
| Practice | Recommendation |
|---|---|
| Deployment | Active/Standby hoặc Cluster |
| Network | Private access (VPC only) |
| Instance size | Start with m5.large, scale up |
| Monitoring | CloudWatch metrics + Broker logs |
| Backup | Automatic + manual snapshots |
7.3 High Availability
8. Common Exam Questions
Q1: When to use Amazon MQ over SQS/SNS?
A: Migrate existing apps using JMS, AMQP, MQTT, STOMP. No code changes needed.
Q2: Amazon MQ HA modes?
A: Single-instance (no HA), Active/Standby (ActiveMQ), Cluster (RabbitMQ)
Q3: Storage for ActiveMQ HA?
A: Amazon EFS (shared storage between Active/Standby)
Q4: Protocols supported?
A: OpenWire, AMQP, STOMP, MQTT, WebSocket
Q5: Can Amazon MQ scale automatically like SQS?
A: No, limited by broker instance size. SQS has unlimited scale.