An Eventarc Advanced bus lets you centralize, monitor, and trace the flow of messages through your system, and acts as a router. It receives events from a message source or published by a provider, and evaluates them according to an enrollment. An enrollment identifies a subscription to a particular bus, and defines the matching criteria for messages, causing them to be routed accordingly. For more information, see Create an enrollment to receive events.
A bus can be used by event providers and destinations in your project or in other projects. For more information, see Project layouts.
Required roles
An Identity and Access Management (IAM) role contains a set of permissions that lets you perform specific actions on Google Cloud resources. The following roles and permissions are required when creating a bus to route messages:
- To get the permission that you need to create a bus, ask your
administrator to grant you either the
Eventarc Admin
(
roles/eventarc.admin
) or the Eventarc Message Bus Admin (roles/eventarc.messageBusAdmin
) IAM role on your bus project. These predefined roles contain theeventarc.messageBuses.create
permission, which is required to create a bus. - To get the permission that you need to use a bus, ask your
administrator to grant you the
Eventarc Message Bus User
(
roles/eventarc.messageBusUser
) IAM role on your bus project. This predefined role contains theeventarc.buses.use
permission, which is required to use a bus. - To create a pipeline and an enrollment, additional permissions are required. For more information, see the required roles when creating an enrollment.
For more information about granting roles, see Manage access. You might also be able to get these permissions with custom roles or other predefined roles.
Create a bus
You can create a bus in the Google Cloud console or by using the gcloud CLI.
Console
In the Google Cloud console, go to the Eventarc > Bus page.
Click
Create bus.On the Create a bus page, do the following:
- Enter a Bus name. This is the ID for your bus.
- Optional: Enter a Bus display name which is displayed on the Bus details page.
- In the Region list, select a supported region to deploy your bus in.
- For Encryption, accept the default Google-managed encryption key or select Cloud KMS key. For more information, see Use customer-managed encryption keys (CMEK).
If you select Cloud KMS key, do the following:
In the Key type list, select a method to manage your keys.
You can manage your keys manually or you can use Autokey which lets you generate key rings and keys on-demand. If the Cloud KMS with Autokey option is disabled, it isn't yet integrated with the current resource type.
In the Select a Cloud KMS key, select a key.
Note that you must select a region before you can view your customer-managed keys.
Optional: To manually enter the resource name of the key, in the Select a customer-managed key list, click Enter key manually, and enter the key name in the specified format.
If prompted, grant the
cloudkms.cryptoKeyEncrypterDecrypter
role to the Eventarc Service Agent.
Optional: To add a message source, click
Add source.- In the Add message source pane, for the Google API message
provider, accept the default of
google-api-source
or enter a different source name. Click Create.
This enables the automatic collection of events coming directly from Google sources.
Note that only events from resources in the same Google Cloud project as the bus are published. For more information, see Publish events from Google sources.
- In the Add message source pane, for the Google API message
provider, accept the default of
Optional: To add labels, click What are labels?
Add label. Labels are key-value pairs that help you organize your Google Cloud resources. For more information, see
Click Create.
gcloud
Open a terminal.
Create a bus by using the
gcloud beta eventarc message-buses create
command.gcloud beta eventarc message-buses create BUS_NAME \ --location=REGION
Replace the following:
BUS_NAME
: the ID or fully qualified identifier of the busREGION
: a supported location for the busAlternatively, you can set the Google Cloud CLI location property:
gcloud config set eventarc/location REGION
Optional: You can also use the following flags:
--async
to return from the command immediately, without waiting for the operation in progress to complete.--crypto-key
to specify the fully qualified name of a customer-managed encryption key; if unspecified, Google-owned and managed keys are used.--logging-config
to configure the logging level which must be one of the following:NONE
,DEBUG
,INFO
,NOTICE
,WARNING
,ERROR
,CRITICAL
,ALERT
,EMERGENCY
.
Delete a bus
You can delete a bus in the Google Cloud console or by using the gcloud CLI.
Console
In the Google Cloud console, go to the Eventarc > Bus page.
Click the name of the bus that you want to delete.
The Bus details page opens.
Click
Delete.When prompted to delete the bus, to acknowledge that any message sources configured to use the bus will no longer be able to, select the Do you want to proceed? checkbox.
To confirm the deletion, enter
Delete
.Click Delete.
gcloud
Open a terminal.
Delete a bus by using the
gcloud beta eventarc message-buses delete
command.gcloud beta eventarc message-buses delete BUS_NAME \ --location=REGION
Replace the following:
BUS_NAME
: the ID or fully qualified identifier of the busREGION
: the supported location for the bus