Running a Message Broker with Amazon MQ - Choosing Between ActiveMQ and RabbitMQ and Migration Patterns
Compare ActiveMQ and RabbitMQ selection criteria, explore migration patterns from on-premises, and learn about high-availability configurations. Also covers when to use SQS/SNS instead.
Amazon MQ's Role and When to Use SQS/SNS Instead
Amazon MQ is a fully managed broker service for ActiveMQ and RabbitMQ. While SQS and SNS are AWS-native messaging services, MQ provides managed operation of industry-standard message brokers. SQS offers unlimited throughput, automatic scaling, and excellent serverless integration, making it the first choice for new cloud-native applications. However, when existing applications depend on the JMS API, AMQP protocol, or complex routing rules (topic selectors, message filters), rewriting for SQS/SNS can be costly. MQ is also appropriate when advanced standard protocol features such as message priority control, transaction management, and complex routing patterns are required. A strategy of gradually refactoring to SQS or SNS after migration is also effective.
Choosing Between ActiveMQ and RabbitMQ
ActiveMQ has strong affinity with the Java ecosystem, is fully JMS 1.1 compliant, and handles up to 1,000 connections per broker. It supports all ActiveMQ features including queues, topics, virtual topics, and composite destinations. The Network of Brokers configuration connects multiple brokers to build scalable messaging topologies. It simultaneously supports multiple protocols including STOMP, MQTT, and OpenWire, making it useful as a bridge between IoT devices and enterprise applications. RabbitMQ natively supports AMQP 0-9-1 and features flexible routing through Exchanges (Direct, Topic, Fanout, Headers) and Bindings. Cluster deployment configures quorum queues to ensure high availability and data durability. It has rich client libraries for Python, Ruby, Go, .NET, and other languages, making it well suited for polyglot environments. A management UI is provided out of the box for monitoring queue status and message rates from a browser.
High Availability and Security
ActiveMQ's active/standby configuration places two broker instances in different AZs, persisting messages on shared EFS storage. When the primary fails, the standby automatically takes over, with failover completing in tens of seconds. RabbitMQ's cluster deployment configures a 3-node cluster with queue mirroring to ensure message durability. Both engines provide multi-AZ automatic failover, EBS volume message persistence, and KMS encryption at rest as standard. CloudWatch metrics monitor broker health, and CloudTrail provides API operation audit logs. The following is an example of creating a RabbitMQ broker with the AWS CLI: ``` aws mq create-broker \ --broker-name my-rabbitmq-broker \ --engine-type RABBITMQ \ --engine-version 3.11.20 \ --host-instance-type mq.m5.large \ --deployment-mode CLUSTER_MULTI_AZ \ --users Username=admin,Password=MySecurePass123 ```
On-Premises Migration Strategy
Migrating from on-premises ActiveMQ to Amazon MQ involves three steps: broker configuration migration, client connection changes, and network configuration adjustments. Amazon MQ supports the same configuration file format (activemq.xml) as on-premises ActiveMQ, so existing configurations can be applied almost directly. A blue-green migration is recommended, connecting on-premises via VPN or Direct Connect and gradually switching clients to Amazon MQ. For RabbitMQ, the Shovel or Federation plugins enable message forwarding between on-premises and cloud to minimize downtime. For post-migration performance tuning, instance type selection (mq.m5.large for approximately 1,000 msg/sec, mq.m5.4xlarge for approximately 10,000 msg/sec), storage type selection, and prefetch size adjustment are important. For more detailed coverage of Amazon MQ, related books on Amazon are a helpful resource.
Amazon MQ Pricing
Amazon MQ pricing consists of per-broker-instance hourly charges and storage. An ActiveMQ mq.m5.large costs approximately $0.288 per hour (about $207 per month), while a RabbitMQ mq.m5.large costs approximately $0.302 per hour (about $217 per month). Active/standby configurations double the instance cost. Storage costs approximately $0.10 per GB per month. Compared to SQS (approximately $0.40 per million requests), MQ is more expensive, so SQS/SNS should be the first choice for anything other than migrating existing message brokers.
Summary
Amazon MQ is a fully managed service for lift-and-shift migration of existing message brokers to AWS. It supports industry-standard protocols for ActiveMQ and RabbitMQ (JMS, AMQP, STOMP, MQTT), enabling migration with no code changes. With multi-AZ automatic failover, KMS encryption, and CloudWatch monitoring as standard, it minimizes infrastructure operational burden while improving messaging application reliability. The key decision criterion is to choose SQS/SNS for new development and MQ for migrating existing applications.