Skip to content

feat(lambda-worker): Support Temporal creds config via Secrets Manager - #2145

Open
johanngan wants to merge 2 commits into
mainfrom
johanngan/aws-secrets-manager
Open

johanngan wants to merge 2 commits into
mainfrom
johanngan/aws-secrets-manager

Conversation

@johanngan

Copy link
Copy Markdown
Contributor

What was changed

The aws.secrets_manager module defines a new envconfig extension to support Temporal client credentials stored in AWS Secrets Manager. The user specifies a secret ARN or friendly name via envconfig (TOML or environment variables), and the client will automatically fetch the secret material from Secrets Manager. Periodic refreshes are only supported for API keys for now, with TLS cert rotation support deferred to later since there's no easy way to do it right now.

The AWS Parameters and Secrets Lambda Extension is used if detected in the environment. Otherwise, secrets are retrieved directly from Secrets Manager.

See the README or package documentation for usage details.

The Lambda worker module now uses the secretsmanager envconfig extension to support Temporal credentials in AWS Secrets Manager within Lambda workers.

Also see the Go reference implementation:

Why?

The aws.secrets_manager extension is intended to be used with the Lambda worker module (and in the future other serverless providers), to make it more convenient to store worker secrets in a secrets manager when using serverless. This makes it more convenient to store worker secrets in a secrets manager when using serverless.

Checklist

  1. How was this tested:
    Added new unit tests. Also did Claude-assisted E2E verification with a serverless Lambda worker setup configured to read credentials from Secrets Manager (under multiple configurations, including with/without the Lambda extension fetcher, with/without TLS client cert bundling, and using TOML/env vars).

  2. Any docs updates needed?
    The associated in-repo docs are updated. This specific module is primarily an implementation detail for the Lambda worker integration with Secrets Manager. We'll probably want to update our public docs for Lambda workers, but that can be done later. We may also want to update the associated sample code in samples-typescript to at least mention this integration as an option.

johanngan and others added 2 commits November 18, 2026 17:09
Add temporalio.contrib.aws.secrets_manager, an envconfig extension that
loads Temporal client credentials (API key and/or TLS material) from AWS
Secrets Manager. The user configures secret IDs (names or ARNs) under
profile.<profile>.ext.aws_secrets_manager in the TOML config or via
TEMPORAL_EXT_AWS_SECRETS_MANAGER_* environment variables, and the
extension's client plugin fetches the secret material when a client
connects.

Secrets are fetched through the AWS Parameters and Secrets Lambda
Extension if it is detected, and otherwise directly with boto3, which is
available via the new boto3 extra. Fetched secrets are TTL-cached, with
fallback to the last fetched value during Secrets Manager outages. The
cache isn't bound to an event loop, so it can be shared across clients
on different loops, such as the per-invocation loops of a Lambda worker.
The API key is refreshed in the background while a client is connected;
TLS material is only fetched on connect, since the bridge doesn't yet
support dynamic client certificates.

Logs and metrics match the Go implementation. See the README for
details.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Load the Lambda worker's client config with the AWS Secrets Manager
envconfig extension, so client credentials can be configured as Secrets
Manager secret IDs. The client plugin list is now copied per invocation,
so plugins appended in the configure callback don't accumulate across
invocations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@johanngan
johanngan requested a review from a team as a code owner November 18, 2026 23:29
Comment thread pyproject.toml
"protobuf<7",
]
aioboto3 = ["aioboto3>=10.4.0", "types-aioboto3[s3]>=10.4.0"]
boto3 = ["boto3>=1.26.0,<2"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we adding a separate boto3 dependency? Notably aioboto3 is right above it, why doesn't that work?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants