Managed Message Broker - Building Enterprise Messaging Infrastructure with Amazon MQ

Learn how to build managed message brokers with Apache ActiveMQ and RabbitMQ using Amazon MQ. This article covers migration strategies from on-premises messaging systems and when to choose MQ over SQS.

Enterprise Messaging and the Role of Amazon MQ

Enterprise systems widely use message brokers for asynchronous communication between applications. Legacy applications that depend on industry-standard protocols such as JMS (Java Message Service), AMQP, STOMP, MQTT, and OpenWire face messaging infrastructure compatibility challenges during cloud migration. Amazon MQ provides fully managed message brokers for Apache ActiveMQ and RabbitMQ, enabling cloud migration while maintaining compatibility with existing messaging protocols. Running ActiveMQ or RabbitMQ on-premises requires broker clustering, storage management, patching, monitoring configuration, and disaster recovery design. Amazon MQ automates these operational tasks, letting you focus on developing messaging applications.

Amazon MQ for ActiveMQ and RabbitMQ Features

Amazon MQ for ActiveMQ is fully compliant with JMS 1.1 and supports all ActiveMQ features including queues, topics, virtual topics, and composite destinations. Network of Brokers configurations let you connect multiple brokers to build scalable messaging topologies. Amazon MQ for RabbitMQ supports the AMQP 0-9-1 protocol and provides flexible message routing through Exchanges, Queues, and Bindings. Cluster deployments configure quorum queues across three broker nodes for high availability and data durability. Both engines provide multi-AZ deployment with automatic failover, message persistence on EBS volumes, and KMS encryption as standard. CloudWatch metrics for broker health monitoring and CloudTrail audit logs for API operations are also available. Here 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 ```

Choosing Between Amazon MQ and SQS

Amazon MQ and Amazon SQS are both messaging services, but they differ in design philosophy and use cases. SQS is an AWS-native fully managed queue service that excels at unlimited throughput, automatic scaling, and serverless architecture integration. For new cloud-native application development, SQS is the first choice. Amazon MQ, on the other hand, is ideal for cloud migration of applications that depend on existing messaging protocols (JMS, AMQP, STOMP, MQTT). Its greatest advantage is the ability to migrate from on-premises ActiveMQ or RabbitMQ with minimal code changes. Amazon MQ is also suitable when you need advanced features of standard protocols such as message priority control, transaction management, and complex routing patterns. A strategy of gradually refactoring to SQS or SNS after migration is also effective. To broaden your knowledge of service integration, specialized books on Amazon can also be useful.

Migration Strategy and Best Practices from On-Premises

Migration from on-premises ActiveMQ to Amazon MQ proceeds in three steps: migrating broker configuration, changing client connection targets, and adjusting network configuration. Amazon MQ supports the same configuration file format (activemq.xml) as on-premises ActiveMQ, so you can apply existing configurations almost as-is. A blue-green migration is recommended, using VPN or Direct Connect to establish connectivity with on-premises and gradually switching clients to Amazon MQ. For RabbitMQ, you can use the Shovel plugin or Federation plugin to set up message forwarding between on-premises and cloud, minimizing downtime. Key post-migration performance tuning considerations include instance type selection (mq.m5.large for approximately 1,000 msg/sec, mq.m5.4xlarge for approximately 10,000 msg/sec), storage type (general-purpose SSD on EBS is sufficient in most cases), and prefetch size adjustment.

Amazon MQ Pricing

ActiveMQ mq.m5.large costs approximately $207/month, and RabbitMQ mq.m5.large costs approximately $217/month. Active/standby configurations double the instance cost. Storage costs approximately $0.10 per GB/month. Compared to SQS (approximately $0.40 per million requests), the cost is higher, so SQS/SNS should be considered first for use cases other than migrating from existing message brokers.

Summary - Choosing a Managed Message Broker

Amazon MQ is a managed message broker that enables cloud migration while maintaining compatibility with existing messaging protocols. It supports both ActiveMQ and RabbitMQ engines and handles industry-standard protocols including JMS, AMQP, STOMP, and MQTT. For new development, SQS and SNS should be the first choice, with Amazon MQ selected when migrating existing systems or when advanced features of standard protocols are needed. As a fully managed service, it comes with multi-AZ automatic failover, KMS encryption, and CloudWatch monitoring as standard, minimizing infrastructure operational burden while improving messaging application reliability.