SAABlog
IntegrationIntermediate

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.

PHILOLAMB-
Amazon MQMessage BrokerActiveMQRabbitMQMigration

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?

ScenarioRecommended Engine
Java/JMS-based legacy appsActiveMQ
Multi-language clientsRabbitMQ
Complex message routingActiveMQ
Cluster high availabilityRabbitMQ
AMQP 0-9-1 protocol neededRabbitMQ

Amazon MQ vs SQS/SNS

Comparison Table

AspectAmazon MQSQSSNS
TypeManaged brokerMessage queuePub/Sub
ProtocolsJMS, AMQP, MQTTAWS APIAWS API
ScalabilityBroker size limitedVirtually unlimitedVirtually unlimited
ManagementBroker instance mgmtFully serverlessFully serverless
PricingInstance + storagePer requestPer publish
MigrationMinimal code changesCode rewrite neededCode 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)

ItemActiveMQRabbitMQ
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 TransferStandard EC2 ratesStandard 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

  1. Migration: "On-premises ActiveMQ → AWS" → Amazon MQ
  2. Protocol Requirements: "JMS, AMQP needed" → Amazon MQ
  3. New vs Legacy Apps: New → SQS/SNS, Legacy → Amazon MQ
  4. Scalability Requirements: "Unlimited scaling" → SQS (not Amazon MQ)
  5. 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.


References