Amazon MQ
Overview
Amazon MQ is a managed message broker service for Apache ActiveMQ and RabbitMQ. It provides a familiar broker-based messaging environment for applications that use standard messaging protocols (JMS, AMQP, STOMP, MQTT). Amazon MQ reduces operational overhead by managing broker provisioning, patching, failure recovery, and scaling while preserving broker semantics (transactions, durable subscriptions, broker-managed ordering).
Key features
- Managed ActiveMQ and RabbitMQ engines.
- Protocol support: JMS, AMQP, MQTT, STOMP, WebSocket.
- Durable brokers with options for high availability (Active/Standby across AZs for ActiveMQ; RabbitMQ cluster options).
- Persistent storage for durable messages and durable subscriptions.
- Support for transactions, acknowledgements, broker-side routing, and quality-of-service features.
- Encryption at rest (SSE-KMS) and in transit (TLS).
- VPC deployment with security groups and IAM-based access for management operations.
- Monitoring via CloudWatch, and audit logging via CloudTrail.
- Automated minor version upgrades, backups, and maintenance windows.
Common use cases
- Lift-and-shift migration of JMS-based or broker-dependent enterprise applications to AWS with minimal code change.
- Applications requiring broker features: message selectors, durable topics, transactions, and complex routing.
- Interoperability with legacy systems or third-party apps that depend on AMQP/JMS brokers.
- Use cases where in-order delivery and broker-managed message semantics are essential.
When to choose Amazon MQ
- You have existing applications that use JMS/AMQP and require minimal refactoring.
- You need broker capabilities such as transactions, durable topics/subscriptions, or advanced message routing.
- You require protocol compatibility with existing clients (e.g., JMS clients).
Consider alternatives (SQS, SNS, Kinesis, MSK) when you prefer serverless queueing, massive horizontally scalable streams, or Kafka-compatible ecosystems.
Basic CLI examples
Create an ActiveMQ broker (simplified example):
aws mq create-broker \
--broker-name my-activemq-broker \
--engine-type ACTIVEMQ \
--engine-version 5.15.13 \
--host-instance-type mq.t3.micro \
--publicly-accessible false \
--users Username=admin,Password='MyP@ssw0rd' \
--deployment-mode ACTIVE_STANDBY_MULTI_AZ
Describe brokers:
aws mq describe-broker --broker-id <broker-id>
Delete a broker:
aws mq delete-broker --broker-id <broker-id>
Best practices
- Size brokers for expected throughput and storage; monitor metrics and scale instance types as needed.
- Use Active/Standby Multi-AZ (ActiveMQ) or clustered RabbitMQ deployments for high availability.
- Secure brokers with TLS, VPC-only access, security groups, and strict IAM policies.
- Enable SSE-KMS to protect messages at rest and rotate keys per compliance needs.
- Use durable subscriptions and persistent delivery for critical messages.
- Monitor broker metrics (queue depth, pending messages, CPU, memory, disk) and set CloudWatch alarms.
- Plan for backups and retention: test recovery procedures in your environment.
- Prefer Amazon MQ for lift-and-shift scenarios; consider SQS/Kinesis/MSK for cloud-native, highly elastic, or serverless designs.
Limitations & considerations
- Not serverless: you provision broker instances and storage; scaling is vertical/horizontal via broker reconfiguration.
- Operational cost and management model differ from SQS or Firehose; evaluate TCO for long-term workloads.
- Throughput and scaling characteristics differ from stream/queue services (Kinesis, SQS); benchmark for your load patterns.
- Message size limits and persistence behavior follow broker engine defaults; verify limits for your engine/version.
