Configure a worker filter
A Boundary worker filter is a boolean expression that selects which workers can handle a resource. You set filters on targets to control session ingress and egress, on Vault credential stores to reach private Vault clusters, and on storage buckets to choose which workers record sessions. Following are some examples of using these values in filters that can be applied to targets, Vault credential stores, or storage buckets:
Name regex:
"/name" matches "web-prod-us-east-[12]", which would match workers whose names areweb-prod-us-east-1orweb-prod-us-east-2Region:
"us-east-1" in "/tags/region".Grouping:
("us-east-1" in "/tags/region" and "/name" == "web-prod-us-east-1") or "webserver" in "/tags/type"
Each tag can have multiple values, so you must use the in operator to match values. If you know that you have only one value, an equivalent would be "/tags/key/0" == "value".
Refer to Filtering and listing resources for more information about Boundary's filter syntax and best practices.
Before you configure a filter, add tags to your workers. Refer to Route traffic through a worker to learn how to tag a worker.
Generate a filter in the Admin UI
The Admin UI includes a filter generator that formats a filter from a worker tag or a worker name. Use the generator when you want Boundary to construct the filter syntax for you.
The generator appears in the following places in the Admin UI:
- On a target, when you select the Workers tab and click Add Worker Filter or Edit Worker Filter.
- On a Vault credential store, when you select Vault as the credential store type.
- On a storage bucket, in the Worker Filter field.
Dynamic host catalogs also accept a worker filter, but they do not include the generator. You must write those filters yourself.
Complete the following steps to generate a filter:
If the generator is not visible, select Show filter generator.
Select whether you want to format a worker Tag or a worker Name.
Enter the input values for the option you selected:
- For Tag, enter the tag Key and the tag Value.
- For Name, select an Operator, and then enter the worker name as the Value.
Click Copy to copy the Generated result.
Paste the generated filter into the filter editor, and then click Save.
The generator formats the following filters:
| Option | Input values | Generated filter |
|---|---|---|
| Tag | Key type, value egress | "egress" in "/tags/type" |
| Tag | Key region, value us-east-1 | "us-east-1" in "/tags/region" |
| Name | Operator ==, value egress-worker-1 | "/name" == "egress-worker-1" |
| Name | Operator matches (regex), value egress-worker-1 | "/name" matches "egress-worker-1" |
| Name | Operator contains, value egress-worker-1 | "/name" contains "egress-worker-1" |
The generator formats one tag or one name at a time.
To combine conditions, generate each expression separately, and then join them in the editor using the and and or operators.
Refer to Filtering and listing resources for the full filter syntax.
Example worker filter for targets
Once workers have tags, you can use these tags to control which workers are allowed to manage a given session by specifying worker filter attributes when you configure targets.
The egress_worker_filter attribute controls which workers are used for egress to a target. This is the worker
that accesses the target.
The ingress_worker_filter attribute controls which workers are used for ingress to a target.
This is the worker a client connects to when initiating a connection to a target.
Example of a filter configured on a target in the Admin UI:

Example worker filter for Vault credential store
Tags are used to control which workers can manage Vault requests by specifying
a worker_filterattribute when configuring credential stores.
This allows the use of private Vault instances with Boundary. Workers deployed in the same network as a private Vault instance can access and relay Vault requests to Boundary controllers.
Example of a worker filter configured on a Vault credential store in the Admin UI:

Example worker filter for storage buckets
Session recording functions are performed by Boundary workers. Workers also store recordings on Boundary storage buckets. When you create Boundary storage buckets, you can use tags to select the workers you prefer to use for session recording responsibilities.
Example of a worker filter configured on a storage bucket in the Admin UI:

Next steps
After you configure a worker filter, you can configure multi-hop sessions to chain workers across networks. Multi-hop deployments use ingress and egress filters to route a session through the chain.
You can also verify SSH host identity on the worker that connects to targets.
If a session fails because no workers match the filter, refer to Troubleshoot workers.