Class CfnBroker

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, IBrokerRef, IEnvironmentAware, ITaggable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.121.0 (build d7af9b9)", date="2025-12-18T18:20:03.927Z") @Stability(Stable) public class CfnBroker extends CfnResource implements IInspectable, IBrokerRef, ITaggable
Creates a broker. Note: This API is asynchronous.

To create a broker, you must either use the AmazonMQFullAccess IAM policy or include the following EC2 permissions in your IAM policy.

  • ec2:CreateNetworkInterface

This permission is required to allow Amazon MQ to create an elastic network interface (ENI) on behalf of your account.

  • ec2:CreateNetworkInterfacePermission

This permission is required to attach the ENI to the broker instance.

  • ec2:DeleteNetworkInterface
  • ec2:DeleteNetworkInterfacePermission
  • ec2:DetachNetworkInterface
  • ec2:DescribeInternetGateways
  • ec2:DescribeNetworkInterfaces
  • ec2:DescribeNetworkInterfacePermissions
  • ec2:DescribeRouteTables
  • ec2:DescribeSecurityGroups
  • ec2:DescribeSubnets
  • ec2:DescribeVpcs

For more information, see Create an IAM User and Get Your AWS Credentials and Never Modify or Delete the Amazon MQ Elastic Network Interface in the Amazon MQ Developer Guide .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.amazonmq.*;
 CfnBroker cfnBroker = CfnBroker.Builder.create(this, "MyCfnBroker")
         .brokerName("brokerName")
         .deploymentMode("deploymentMode")
         .engineType("engineType")
         .hostInstanceType("hostInstanceType")
         .publiclyAccessible(false)
         // the properties below are optional
         .authenticationStrategy("authenticationStrategy")
         .autoMinorVersionUpgrade(false)
         .configuration(ConfigurationIdProperty.builder()
                 .id("id")
                 .revision(123)
                 .build())
         .dataReplicationMode("dataReplicationMode")
         .dataReplicationPrimaryBrokerArn("dataReplicationPrimaryBrokerArn")
         .encryptionOptions(EncryptionOptionsProperty.builder()
                 .useAwsOwnedKey(false)
                 // the properties below are optional
                 .kmsKeyId("kmsKeyId")
                 .build())
         .engineVersion("engineVersion")
         .ldapServerMetadata(LdapServerMetadataProperty.builder()
                 .hosts(List.of("hosts"))
                 .roleBase("roleBase")
                 .roleSearchMatching("roleSearchMatching")
                 .serviceAccountUsername("serviceAccountUsername")
                 .userBase("userBase")
                 .userSearchMatching("userSearchMatching")
                 // the properties below are optional
                 .roleName("roleName")
                 .roleSearchSubtree(false)
                 .serviceAccountPassword("serviceAccountPassword")
                 .userRoleName("userRoleName")
                 .userSearchSubtree(false)
                 .build())
         .logs(LogListProperty.builder()
                 .audit(false)
                 .general(false)
                 .build())
         .maintenanceWindowStartTime(MaintenanceWindowProperty.builder()
                 .dayOfWeek("dayOfWeek")
                 .timeOfDay("timeOfDay")
                 .timeZone("timeZone")
                 .build())
         .securityGroups(List.of("securityGroups"))
         .storageType("storageType")
         .subnetIds(List.of("subnetIds"))
         .tags(List.of(TagsEntryProperty.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .users(List.of(UserProperty.builder()
                 .password("password")
                 .username("username")
                 // the properties below are optional
                 .consoleAccess(false)
                 .groups(List.of("groups"))
                 .replicationUser(false)
                 .build()))
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnBroker

      protected CfnBroker(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnBroker

      protected CfnBroker(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnBroker

      @Stability(Stable) public CfnBroker(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnBrokerProps props)
      Create a new AWS::AmazonMQ::Broker.

      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • arnForBroker

      @Stability(Stable) @NotNull public static String arnForBroker(@NotNull IBrokerRef resource)
      Parameters:
      resource - This parameter is required.
    • isCfnBroker

      @Stability(Stable) @NotNull public static Boolean isCfnBroker(@NotNull Object x)
      Checks whether the given object is a CfnBroker.

      Parameters:
      x - This parameter is required.
    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrAmqpEndpoints

      @Stability(Stable) @NotNull public List<String> getAttrAmqpEndpoints()
      The AMQP endpoints of each broker instance as a list of strings.

      amqp+ssl://b-4aada85d-a80c-4be0-9d30-e344a01b921e-1.mq.eu-central-amazonaws.com:5671

    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      The Amazon Resource Name (ARN) of the Amazon MQ broker.

      arn:aws:mq:us-east-2:123456789012:broker:MyBroker:b-1234a5b6-78cd-901e-2fgh-3i45j6k178l9

    • getAttrConfigurationId

      @Stability(Stable) @NotNull public String getAttrConfigurationId()
      The unique ID that Amazon MQ generates for the configuration.

      c-1234a5b6-78cd-901e-2fgh-3i45j6k178l9

    • getAttrConfigurationRevision

      @Stability(Stable) @NotNull public Number getAttrConfigurationRevision()
      The revision number of the configuration.

      1

    • getAttrConsoleUrLs

      @Stability(Stable) @NotNull public List<String> getAttrConsoleUrLs()
    • getAttrEngineVersionCurrent

      @Stability(Stable) @NotNull public String getAttrEngineVersionCurrent()
      The version in use.

      This may have more precision than the specified EngineVersion.

    • getAttrId

      @Stability(Stable) @NotNull public String getAttrId()
    • getAttrIpAddresses

      @Stability(Stable) @NotNull public List<String> getAttrIpAddresses()
      The IP addresses of each broker instance as a list of strings. Does not apply to RabbitMQ brokers.

      ['198.51.100.2', '203.0.113.9']

    • getAttrMqttEndpoints

      @Stability(Stable) @NotNull public List<String> getAttrMqttEndpoints()
      The MQTT endpoints of each broker instance as a list of strings.

      mqtt+ssl://b-4aada85d-a80c-4be0-9d30-e344a01b921e-1.mq.eu-central-amazonaws.com:8883

    • getAttrOpenWireEndpoints

      @Stability(Stable) @NotNull public List<String> getAttrOpenWireEndpoints()
      The OpenWire endpoints of each broker instance as a list of strings.

      ssl://b-4aada85d-a80c-4be0-9d30-e344a01b921e-1.mq.eu-central-amazonaws.com:61617

    • getAttrStompEndpoints

      @Stability(Stable) @NotNull public List<String> getAttrStompEndpoints()
      The STOMP endpoints of each broker instance as a list of strings.

      stomp+ssl://b-4aada85d-a80c-4be0-9d30-e344a01b921e-1.mq.eu-central-amazonaws.com:61614

    • getAttrWssEndpoints

      @Stability(Stable) @NotNull public List<String> getAttrWssEndpoints()
      The WSS endpoints of each broker instance as a list of strings.

      wss://b-4aada85d-a80c-4be0-9d30-e344a01b921e-1.mq.eu-central-amazonaws.com:61619

    • getBrokerRef

      @Stability(Stable) @NotNull public BrokerReference getBrokerRef()
      A reference to a Broker resource.
      Specified by:
      getBrokerRef in interface IBrokerRef
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getTags in interface ITaggable
    • getBrokerName

      @Stability(Stable) @NotNull public String getBrokerName()
      Required.
    • setBrokerName

      @Stability(Stable) public void setBrokerName(@NotNull String value)
      Required.
    • getDeploymentMode

      @Stability(Stable) @NotNull public String getDeploymentMode()
      Required.
    • setDeploymentMode

      @Stability(Stable) public void setDeploymentMode(@NotNull String value)
      Required.
    • getEngineType

      @Stability(Stable) @NotNull public String getEngineType()
      Required.
    • setEngineType

      @Stability(Stable) public void setEngineType(@NotNull String value)
      Required.
    • getHostInstanceType

      @Stability(Stable) @NotNull public String getHostInstanceType()
      Required.
    • setHostInstanceType

      @Stability(Stable) public void setHostInstanceType(@NotNull String value)
      Required.
    • getPubliclyAccessible

      @Stability(Stable) @NotNull public Object getPubliclyAccessible()
      Enables connections from applications outside of the VPC that hosts the broker's subnets.

      Returns union: either Boolean or IResolvable

    • setPubliclyAccessible

      @Stability(Stable) public void setPubliclyAccessible(@NotNull Boolean value)
      Enables connections from applications outside of the VPC that hosts the broker's subnets.
    • setPubliclyAccessible

      @Stability(Stable) public void setPubliclyAccessible(@NotNull IResolvable value)
      Enables connections from applications outside of the VPC that hosts the broker's subnets.
    • getAuthenticationStrategy

      @Stability(Stable) @Nullable public String getAuthenticationStrategy()
      Optional.
    • setAuthenticationStrategy

      @Stability(Stable) public void setAuthenticationStrategy(@Nullable String value)
      Optional.
    • getAutoMinorVersionUpgrade

      @Stability(Stable) @Nullable public Object getAutoMinorVersionUpgrade()
      Enables automatic upgrades to new patch versions for brokers as new versions are released and supported by Amazon MQ.

      Returns union: either Boolean or IResolvable

    • setAutoMinorVersionUpgrade

      @Stability(Stable) public void setAutoMinorVersionUpgrade(@Nullable Boolean value)
      Enables automatic upgrades to new patch versions for brokers as new versions are released and supported by Amazon MQ.
    • setAutoMinorVersionUpgrade

      @Stability(Stable) public void setAutoMinorVersionUpgrade(@Nullable IResolvable value)
      Enables automatic upgrades to new patch versions for brokers as new versions are released and supported by Amazon MQ.
    • getConfiguration

      @Stability(Stable) @Nullable public Object getConfiguration()
      A list of information about the configuration.

      Returns union: either IResolvable or CfnBroker.ConfigurationIdProperty

    • setConfiguration

      @Stability(Stable) public void setConfiguration(@Nullable IResolvable value)
      A list of information about the configuration.
    • setConfiguration

      @Stability(Stable) public void setConfiguration(@Nullable CfnBroker.ConfigurationIdProperty value)
      A list of information about the configuration.
    • getDataReplicationMode

      @Stability(Stable) @Nullable public String getDataReplicationMode()
      Defines whether this broker is a part of a data replication pair.
    • setDataReplicationMode

      @Stability(Stable) public void setDataReplicationMode(@Nullable String value)
      Defines whether this broker is a part of a data replication pair.
    • getDataReplicationPrimaryBrokerArn

      @Stability(Stable) @Nullable public String getDataReplicationPrimaryBrokerArn()
      The Amazon Resource Name (ARN) of the primary broker that is used to replicate data from in a data replication pair, and is applied to the replica broker.
    • setDataReplicationPrimaryBrokerArn

      @Stability(Stable) public void setDataReplicationPrimaryBrokerArn(@Nullable String value)
      The Amazon Resource Name (ARN) of the primary broker that is used to replicate data from in a data replication pair, and is applied to the replica broker.
    • getEncryptionOptions

      @Stability(Stable) @Nullable public Object getEncryptionOptions()
      Encryption options for the broker.

      Returns union: either IResolvable or CfnBroker.EncryptionOptionsProperty

    • setEncryptionOptions

      @Stability(Stable) public void setEncryptionOptions(@Nullable IResolvable value)
      Encryption options for the broker.
    • setEncryptionOptions

      @Stability(Stable) public void setEncryptionOptions(@Nullable CfnBroker.EncryptionOptionsProperty value)
      Encryption options for the broker.
    • getEngineVersion

      @Stability(Stable) @Nullable public String getEngineVersion()
      The broker engine version.
    • setEngineVersion

      @Stability(Stable) public void setEngineVersion(@Nullable String value)
      The broker engine version.
    • getLdapServerMetadata

      @Stability(Stable) @Nullable public Object getLdapServerMetadata()
      Optional.

      Returns union: either IResolvable or CfnBroker.LdapServerMetadataProperty

    • setLdapServerMetadata

      @Stability(Stable) public void setLdapServerMetadata(@Nullable IResolvable value)
      Optional.
    • setLdapServerMetadata

      @Stability(Stable) public void setLdapServerMetadata(@Nullable CfnBroker.LdapServerMetadataProperty value)
      Optional.
    • getLogs

      @Stability(Stable) @Nullable public Object getLogs()
      Enables Amazon CloudWatch logging for brokers.

      Returns union: either IResolvable or CfnBroker.LogListProperty

    • setLogs

      @Stability(Stable) public void setLogs(@Nullable IResolvable value)
      Enables Amazon CloudWatch logging for brokers.
    • setLogs

      @Stability(Stable) public void setLogs(@Nullable CfnBroker.LogListProperty value)
      Enables Amazon CloudWatch logging for brokers.
    • getMaintenanceWindowStartTime

      @Stability(Stable) @Nullable public Object getMaintenanceWindowStartTime()
      The parameters that determine the WeeklyStartTime.

      Returns union: either IResolvable or CfnBroker.MaintenanceWindowProperty

    • setMaintenanceWindowStartTime

      @Stability(Stable) public void setMaintenanceWindowStartTime(@Nullable IResolvable value)
      The parameters that determine the WeeklyStartTime.
    • setMaintenanceWindowStartTime

      @Stability(Stable) public void setMaintenanceWindowStartTime(@Nullable CfnBroker.MaintenanceWindowProperty value)
      The parameters that determine the WeeklyStartTime.
    • getSecurityGroups

      @Stability(Stable) @Nullable public List<String> getSecurityGroups()
      The list of rules (1 minimum, 125 maximum) that authorize connections to brokers.
    • setSecurityGroups

      @Stability(Stable) public void setSecurityGroups(@Nullable List<String> value)
      The list of rules (1 minimum, 125 maximum) that authorize connections to brokers.
    • getStorageType

      @Stability(Stable) @Nullable public String getStorageType()
      The broker's storage type.
    • setStorageType

      @Stability(Stable) public void setStorageType(@Nullable String value)
      The broker's storage type.
    • getSubnetIds

      @Stability(Stable) @Nullable public List<String> getSubnetIds()
      The list of groups that define which subnets and IP ranges the broker can use from different Availability Zones.
    • setSubnetIds

      @Stability(Stable) public void setSubnetIds(@Nullable List<String> value)
      The list of groups that define which subnets and IP ranges the broker can use from different Availability Zones.
    • getTagsRaw

      @Stability(Stable) @Nullable public List<CfnBroker.TagsEntryProperty> getTagsRaw()
      Create tags when creating the broker.
    • setTagsRaw

      @Stability(Stable) public void setTagsRaw(@Nullable List<CfnBroker.TagsEntryProperty> value)
      Create tags when creating the broker.
    • getUsers

      @Stability(Stable) @Nullable public Object getUsers()
      The list of broker users (persons or applications) who can access queues and topics.

      Returns union: either IResolvable or Listinvalid input: '<'either IResolvable or CfnBroker.UserProperty>

    • setUsers

      @Stability(Stable) public void setUsers(@Nullable IResolvable value)
      The list of broker users (persons or applications) who can access queues and topics.
    • setUsers

      @Stability(Stable) public void setUsers(@Nullable List<Object> value)
      The list of broker users (persons or applications) who can access queues and topics.