Description
publicly_accessible = true requests an internet-facing ActiveMQ broker endpoint. Its network settings determine who can reach it, and broker permissions determine who can read or send messages.
Potential impact
Unnecessary public access exposes the broker to unwanted sign-in attempts. A compromised account may disclose or modify messages or interrupt service.
Remediation
- For internal clients, prepare private connectivity and set
publicly_accessible = false. Restrict security groups to the required clients and ports, use TLS and limit each user’s messaging permissions. - Changing the setting replaces the broker. To keep the old broker online during cutover, define the replacement as a separate Terraform resource with a distinct
broker_name. Drain or migrate queued messages. - Test authorized producers and consumers on the replacement and confirm that unapproved sources cannot connect. Switch client endpoints before retiring the old broker.
Examples
Supply a var.activemq_engine_version compatible with the instance type. Configure users and networking separately and protect broker passwords and Terraform state.
Before
resource "aws_mq_broker" "mq_broker" {
broker_name = "example"
engine_type = "ActiveMQ"
engine_version = var.activemq_engine_version
host_instance_type = "mq.t2.micro"
publicly_accessible = true
}
The example broker explicitly requests a public endpoint.
After
resource "aws_mq_broker" "mq_broker" {
broker_name = "example"
engine_type = "ActiveMQ"
engine_version = var.activemq_engine_version
host_instance_type = "mq.t2.micro"
}
Omitting publicly_accessible uses the AWS provider’s default of false. Both snippets use the same broker name.