Description
PubliclyAccessible: true gives an Amazon MQ broker a public endpoint. Network rules control who can connect. Broker authentication and messaging permissions control what clients can do.
Potential impact
An unnecessarily reachable broker can receive unwanted sign-in attempts. A compromised account can expose or change messages and disrupt processing.
Remediation
- For an internal broker, prepare private client paths and security group rules before setting
PubliclyAccessible: false. If public access is required, limit sources and ports. Use TLS and grant only required message operations. - CloudFormation replaces the broker when this setting changes. To run both brokers during cutover, create a separate broker resource with a distinct name. Plan for downtime and drain or migrate queued messages.
- Test producers and consumers on the private endpoint. Switch clients and check pending messages before retiring the old broker.
Examples
The examples create a single-instance ActiveMQ broker using the default engine version. Supply a supported instance type, a subnet and security group in the same VPC, and a username. Store the broker password under the password key in Secrets Manager and grant the deployment identity permission to read that secret.
Before
Parameters:
BrokerName:
Type: String
HostInstanceType:
Type: String
SubnetId:
Type: AWS::EC2::Subnet::Id
SecurityGroupId:
Type: AWS::EC2::SecurityGroup::Id
BrokerUsername:
Type: String
BrokerPasswordSecretArn:
Type: String
Resources:
BasicBroker:
Type: AWS::AmazonMQ::Broker
Properties:
BrokerName: !Ref BrokerName
DeploymentMode: SINGLE_INSTANCE
EngineType: ACTIVEMQ
AutoMinorVersionUpgrade: true
HostInstanceType: !Ref HostInstanceType
SubnetIds:
- !Ref SubnetId
SecurityGroups:
- !Ref SecurityGroupId
Users:
- Username: !Ref BrokerUsername
Password: !Sub '{{resolve:secretsmanager:${BrokerPasswordSecretArn}:SecretString:password}}'
PubliclyAccessible: true
true requests a public broker endpoint. The supplied network and security group determine its reachability.
After
Parameters:
BrokerName:
Type: String
HostInstanceType:
Type: String
SubnetId:
Type: AWS::EC2::Subnet::Id
SecurityGroupId:
Type: AWS::EC2::SecurityGroup::Id
BrokerUsername:
Type: String
BrokerPasswordSecretArn:
Type: String
Resources:
BasicBroker:
Type: AWS::AmazonMQ::Broker
Properties:
BrokerName: !Ref BrokerName
DeploymentMode: SINGLE_INSTANCE
EngineType: ACTIVEMQ
AutoMinorVersionUpgrade: true
HostInstanceType: !Ref HostInstanceType
SubnetIds:
- !Ref SubnetId
SecurityGroups:
- !Ref SecurityGroupId
Users:
- Username: !Ref BrokerUsername
Password: !Sub '{{resolve:secretsmanager:${BrokerPasswordSecretArn}:SecretString:password}}'
PubliclyAccessible: false
false requests a private endpoint. Both templates use BasicBroker and the same BrokerName parameter.