Skip to content

feat(temporal-aws-lambda): Support Temporal creds config via Secrets Manager in Lambda worker - #3227

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 temporal-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 module documentation for usage details.

The temporal-aws-lambda 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 temporal-aws-secrets-manager extension is intended to be used with the Lambda worker contrib package (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:12
Add the experimental temporal-aws-secrets-manager module, an envconfig extension
that loads the client API key and mTLS material from AWS Secrets Manager secret
IDs, configured in TOML or with TEMPORAL_EXT_AWS_SECRETS_MANAGER_* environment
variables. It ports the Go, Python and TypeScript implementations, with the same
config, validation, metric names and log messages.

Secrets are fetched through the AWS Parameters and Secrets Lambda Extension when
it's detected, and otherwise with the AWS SDK for Java 2.x. The AWS SDK is a
compile-only dependency that users add when they need it, and only SdkFetcher
references it, so the module loads without it. Fetched secrets are cached,
refreshed every refresh interval (SECRETS_MANAGER_TTL, default 5 minutes), and
fall back to the previous value for up to 24 hours if a refresh fails.

The plugin fetches the secrets when service stubs are created. The API key
supplier returns the cached key and refreshes it in the background, so requests
never wait on a fetch. TLS secrets are combined with the profile's other TLS
settings into a new SSL context, since an SslContext can't be extended. Client
keys must be PKCS#8, as for envconfig, and a client cert and key that don't
match are treated as a failed fetch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Lambda worker now always loads its client config with the AWS Secrets
Manager extension, so credentials can be configured as secret IDs with
TEMPORAL_EXT_AWS_SECRETS_MANAGER_* environment variables or in temporal.toml.
The extension only adds a plugin when secret IDs are configured. Functions
without the AWS Parameters and Secrets Lambda Extension need to add
software.amazon.awssdk:secretsmanager, since the Lambda Java runtimes don't
include the AWS SDK.

OtelLambdaWorkerConfigurationHelper now adds its OpenTelemetry plugin before
existing service stubs plugins rather than after them, so its metrics scope
is already set when the Secrets Manager plugin fetches TLS secrets while the
stubs are configured. Before, those fetches reported to a no-op scope.

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:27
@johanngan johanngan changed the title Support Temporal creds config via Secrets Manager in Lambda worker feat(temporal-aws-lambda): Support Temporal creds config via Secrets Manager in Lambda worker Nov 18, 2026

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.

1 participant