// Module included in the following assemblies:
//
// * serverless/event_workflows/serverless-using-brokers.adoc

[id="serverless-create-kn-trigger_{context}"]
= Creating a trigger using `kn`

You can create a trigger by using the `kn trigger create` command.

.Procedure

* Create a trigger:
+
[source,terminal]
----
$ kn trigger create <trigger_name> --broker <broker_name> --filter <key=value> --sink <sink_name>
----
+
Alternatively, you can create a trigger and simultaneously create the `default` broker using broker injection:
+
[source,terminal]
----
$ kn trigger create <trigger_name> --inject-broker --filter <key=value> --sink <sink_name>
----
+
By default, triggers forward all events sent to a broker to sinks that are subscribed to that broker.
Using the `--filter` attribute for triggers allows you to filter events from a broker, so that subscribers will only receive a subset of events based on your defined criteria.
