Skip to content

Commit 347e92d

Browse files
Add cloud auth and observability guidance (#4351)
* Add cloud auth and observability guidance * Clarify service account scope and API key rotation --------- Co-authored-by: Brian MacDonald <brian.macdonald@temporal.io>
1 parent a532fff commit 347e92d

6 files changed

Lines changed: 95 additions & 7 deletions

File tree

docs/best-practices/cloud-access-control.mdx

Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ Temporal Cloud supports two secure authentication methods for Workers:
2222

2323
Both options help secure communication between workers and Temporal Cloud. Choosing the right method and managing it properly is key to maintaining security and minimizing downtime.
2424

25+
Use this page to define your operating model for machine access to Temporal Cloud. For setup steps and product-specific
26+
mechanics, see [Manage API keys](/cloud/api-keys) and [Manage service accounts](/cloud/service-accounts).
27+
28+
Related guidance:
29+
- [Namespace best practices](/best-practices/managing-namespace)
30+
- [Multi-tenant application patterns](/production-deployment/multi-tenant-patterns)
31+
2532
The high-level end-to-end rotation process is:
2633

2734
1. **Generate new credentials**: Create new certificates or API keys in Temporal Cloud before the current ones expire
@@ -45,17 +52,64 @@ In the case that you are using multiple certificates signed by the same CA, and
4552

4653
One convention is to give certificates a common name that matches the namespace. If you do this when using the same CA for dev and prod, then you can leverage Certificate Filters to prevent access to production environments. This is described in detail under the [authorization section](https://docs.temporal.io/cloud/certificates#control-authorization) of the documentation.
4754

48-
## Best practices:
49-
#### 1. Establish clear guidelines on authentication methods: Teams should standardize on either [mTLS certificates](https://docs.temporal.io/cloud/certificates) or [API keys](https://docs.temporal.io/cloud/api-keys) for the following operations:
55+
## Best practices
56+
57+
### Establish clear guidelines on authentication methods
58+
59+
Teams should standardize on either [mTLS certificates](https://docs.temporal.io/cloud/certificates) or
60+
[API keys](https://docs.temporal.io/cloud/api-keys) for the following operations:
5061
- Connect Temporal clients to Temporal Cloud (e.g. Worker processes)
5162
- Automation (e.g. Temporal Cloud [Operations API](https://docs.temporal.io/ops), [Terraform provider](https://docs.temporal.io/cloud/terraform-provider), [Temporal CLI](https://docs.temporal.io/cli/setup-cli))
5263

53-
By default, it is recommended for teams to use API keys and [service accounts](https://docs.temporal.io/cloud/service-accounts) for both operations because API keys are easier to manage and rotate for most teams. In addition, you can control account-level and namespace-level roles for service accounts.
64+
By default, teams should use API keys with [service accounts](/cloud/service-accounts) for both operations. API keys
65+
are generally easier to set up and rotate than mTLS certificates, and service accounts let you assign account-level and
66+
namespace-level roles.
67+
68+
If your organization requires mutual authentication and stronger cryptographic guarantees, use
69+
[mTLS certificates](/cloud/certificates) to authenticate Temporal clients to Temporal Cloud and use API keys for
70+
automation, because the Temporal Cloud [Operations API](/ops) and [Terraform provider](/cloud/terraform-provider) only
71+
support API key authentication. Unlike API keys tied to users or service accounts, mTLS certificate authentication is
72+
not tied to Temporal Cloud RBAC identities. Namespace access is based on CA trust, with optional
73+
[Certificate Filters](/cloud/certificates#manage-certificate-filters) to narrow access by Common Name.
74+
75+
### Default operating model for service accounts and API keys
76+
77+
For most organizations, use the following defaults:
78+
79+
- Create one Service Account per service or worker deployment, not one shared Service Account for an entire team
80+
- Use account-level Service Accounts only when a service genuinely needs cross-Namespace or account-wide access
81+
- Prefer Namespace-scoped Service Accounts when a service should only access one Namespace
82+
- Grant Service Accounts namespace-level access only to the specific Namespaces they need
83+
84+
This approach gives you cleaner ownership, easier rotation, and better auditability than sharing a single machine
85+
identity across multiple services.
86+
87+
### Use access boundaries that match your Namespace boundaries
88+
89+
The way you partition Namespaces should usually match the way you partition machine identities.
90+
91+
- If multiple services share a Namespace, you may still want one Service Account per service so that each deployment can
92+
rotate credentials independently.
93+
- If you split workloads into separate Namespaces for security, capacity, or team ownership reasons, those Namespaces
94+
should usually have separate Service Accounts and API keys as well.
95+
- If you use Namespace-per-tenant isolation, expect your credential model and RBAC model to become correspondingly more
96+
granular.
97+
98+
For more on topology tradeoffs, see [Namespace best practices](/best-practices/managing-namespace) and
99+
[Multi-tenant application patterns](/production-deployment/multi-tenant-patterns).
100+
101+
### Rotate credentials without downtime
102+
103+
Use the following sequence when rotating credentials:
54104

55-
If your organization requires mutual authentication and stronger cryptographic guarantees, then it is encouraged for your teams to use mTLS certificates to authenticate Temporal clients to Temporal Cloud and use API keys for automation (because Temporal Cloud [Operations API](https://docs.temporal.io/ops) and [Terraform provider](https://docs.temporal.io/cloud/terraform-provider) only supports API key for authentication)
105+
1. Create the replacement credential before the existing one expires.
106+
2. For API keys, create the new valid key while the old key still works, then roll your Workers and clients to use the new key.
107+
3. For client certificates, stage the new certificate before removing the old one when your deployment process supports that transition.
108+
4. Validate connectivity and normal Workflow execution using the new credential.
109+
5. Remove the old credential only after all clients and Workers have switched.
56110

57-
#### 2. Use Certificate Filters to restrict access when using shared CAs (e.g., `dev` vs `prod`):
111+
### Use Certificate Filters to restrict access when using shared CAs (e.g., `dev` vs `prod`)
58112

59-
Certificate Filters are an additional way of validating using the client certificate presented during client authentication. Give certificates a common name that matches the namespace. This is not a requirement.
113+
Certificate Filters are an additional way of validating using the client certificate presented during client authentication. Give certificates a common name that matches the namespace. This is not a requirement.
60114

61-
If you do this when using the same CA for dev and prod environments, then you can leverage Certificate Filters to prevent access to production.
115+
If you do this when using the same CA for dev and prod environments, then you can leverage Certificate Filters to prevent access to production.

docs/cloud/get-started/api-keys.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ The authentication process follows this pathway:
5757
unexpected or unauthorized activity.
5858
- **Use a Key Management System (KMS)**: Employ a Key Management System to minimize the risk of key leaks.
5959

60+
For guidance on which identities should own API keys, when to use Namespace-scoped Service Accounts, and how to align
61+
API keys with your Namespace topology, see [Managing Temporal Cloud access control](/best-practices/cloud-access-control).
62+
6063
### API key use cases
6164

6265
API keys are used for the following scenarios:
@@ -223,6 +226,9 @@ Temporal API keys automatically expire based on the specified expiration time. F
223226
1. Switch clients to load the new key and start using it.
224227
1. Delete the old key after it is no longer in use.
225228

229+
For a broader machine-identity rotation strategy across API keys and Service Accounts, see
230+
[Managing Temporal Cloud access control](/best-practices/cloud-access-control).
231+
226232
## Manage API keys for Service Accounts {#serviceaccount-api-keys}
227233

228234
Global Administrators and Account Owners can manage and generate API keys for _all_ Service Accounts in their account.

docs/cloud/get-started/service-accounts.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ With the addition of Service Accounts, Temporal Cloud now supports 2 identity ty
3333
Service Accounts use API Keys as the authentication mechanism to connect to Temporal Cloud.
3434
You should use Service Accounts to represent a non-human identity when authenticating to Temporal Cloud for operations automation or the Temporal SDKs and the Temporal CLI for Workflow Execution and management.
3535

36+
For guidance on how to structure Service Accounts across services, Namespaces, and teams, see
37+
[Managing Temporal Cloud access control](/best-practices/cloud-access-control). A common default is one Service Account
38+
per service or worker deployment, with Namespace-scoped Service Accounts preferred when a service only needs access to a
39+
single Namespace.
40+
3641
:::tip
3742

3843
Namespace Admins can now manage and create [Namespace-scoped Service Accounts](/cloud/service-accounts#scoped), regardless of their Account Role.

docs/cloud/metrics/index.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ When used together, Cloud and SDK metrics measure the health and performance of
3333

3434
Cloud metrics for all Namespaces in your account are available from the [OpenMetrics endpoint](/cloud/metrics/openmetrics), a Prometheus-compatible scrapable endpoint at `metrics.temporal.io`.
3535

36+
Use the following rule of thumb when deciding which signal to rely on:
37+
38+
| Question | Primary signal |
39+
|---|---|
40+
| Is Temporal Cloud accepting and serving work normally? | Cloud metrics |
41+
| Are Tasks backing up in a Task Queue? | Cloud metrics plus SDK Schedule-To-Start metrics |
42+
| Are my Workers saturated, under-provisioned, or misconfigured? | SDK metrics |
43+
| Is my application logic, downstream dependency, or Activity behavior unhealthy? | SDK metrics and traces |
44+
45+
For a Worker-focused view of how to combine these signals, see [Monitor worker health](/cloud/worker-health).
46+
3647
- [OpenMetrics overview](/cloud/metrics/openmetrics) - Getting started and key concepts
3748
- [Metrics integrations](/cloud/metrics/openmetrics/metrics-integrations) - Datadog, Grafana Cloud, New Relic, ClickStack, and more
3849
- [API reference](/cloud/metrics/openmetrics/api-reference) - Endpoint specification and advanced configuration

docs/cloud/metrics/openmetrics/metrics-integrations.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ This document is for basic configuration only. For advanced concepts such as lab
3434

3535
Datadog provides a serverless integration with the OpenMetrics endpoint. This integration will scrape metrics, store them in Datadog, and provides a default dashboard with some built in monitors. See the [integration page](https://docs.datadoghq.com/integrations/temporal-cloud-openmetrics/) for more details.
3636

37+
For Datadog users, treat this integration as the Cloud-side half of your observability setup:
38+
39+
- Use OpenMetrics in Datadog to monitor Temporal Cloud behavior such as Task Queue backlog, poll success, and rate limiting.
40+
- Collect [SDK metrics](/cloud/metrics/sdk-metrics-setup) from your Workers separately to monitor saturation, Schedule-To-Start latency, slot availability, and sticky cache behavior.
41+
42+
If you only ingest Cloud metrics, you will miss many worker-side bottlenecks. For recommended Worker monitors, see
43+
[Monitor worker health](/cloud/worker-health).
44+
3745
### Grafana Cloud
3846

3947
Grafana provides a serverless integration with the OpenMetrics endpoint for Grafana Cloud. This integration will scrape metrics, store them in Grafana Cloud, and provides a default dashboard

docs/cloud/worker-health.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ This page is a guide to monitoring a Temporal Worker fleet and covers the follow
3939
- [How to detect misconfigured Workers](#detect-misconfigured-workers)
4040
- [How to configure Sticky cache](#configure-sticky-cache)
4141

42+
This page assumes you are monitoring both Worker-side SDK metrics and Cloud-side metrics. Use SDK metrics to understand
43+
what your Workers are doing, and Cloud metrics to understand what Temporal Cloud is seeing at the Task Queue and service
44+
level. For an overview of how these signals fit together, see [Temporal Cloud metrics](/cloud/metrics).
45+
4246
:::tip
4347

4448
You can also inspect Workers and the Workers assigned to a Task Queue directly in the Temporal UI. See [Visualize Workers in the UI](/develop/worker-performance#visualize-workers).

0 commit comments

Comments
 (0)