Add AWS Secrets Manager API key storage details#36518
Add AWS Secrets Manager API key storage details#36518litianningdatadog wants to merge 3 commits intomasterfrom
Conversation
Added section on storing API key in AWS Secrets Manager with details on formats and permissions.
💡 Codex ReviewWhen the referenced Secrets Manager secret is encrypted with a customer-managed KMS key, granting only documentation/content/en/serverless/aws_lambda/configuration.md Lines 807 to 809 in c91116b This new section says v96 accepts a JSON object with ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
|
||
| This is available for version 88+ of the Datadog Lambda Extension. | ||
|
|
||
| ## Store API key in AWS Secrets Manager |
There was a problem hiding this comment.
Should this section go before "Reload API key secret periodically"?
There was a problem hiding this comment.
| ## Store API key in AWS Secrets Manager | |
| ## Store the API key in AWS Secrets Manager |
|
|
||
| ## Store API key in AWS Secrets Manager | ||
|
|
||
| `DD_API_KEY_SECRET_ARN` specifies the ARN of an AWS Secrets Manager secret that stores your Datadog API key. When set, the Datadog Lambda Extension fetches the secret at cold start and uses its value as the API key. The Lambda function's execution role must be granted secretsmanager:GetSecretValue permission on the referenced ARN. |
There was a problem hiding this comment.
| `DD_API_KEY_SECRET_ARN` specifies the ARN of an AWS Secrets Manager secret that stores your Datadog API key. When set, the Datadog Lambda Extension fetches the secret at cold start and uses its value as the API key. The Lambda function's execution role must be granted secretsmanager:GetSecretValue permission on the referenced ARN. | |
| `DD_API_KEY_SECRET_ARN` specifies the ARN of an AWS Secrets Manager secret that stores your Datadog API key. When set, the Datadog Lambda Extension fetches the secret at cold start and uses its value as the API key. Grant the Lambda function's execution role `secretsmanager:GetSecretValue` permission on the referenced ARN. |
|
|
||
| `DD_API_KEY_SECRET_ARN` specifies the ARN of an AWS Secrets Manager secret that stores your Datadog API key. When set, the Datadog Lambda Extension fetches the secret at cold start and uses its value as the API key. The Lambda function's execution role must be granted secretsmanager:GetSecretValue permission on the referenced ARN. | ||
|
|
||
| Starting v96, the secret value can be stored in either of two formats: |
There was a problem hiding this comment.
| Starting v96, the secret value can be stored in either of two formats: | |
| Starting with version 96, you can store the secret value in one of the following formats: |
| - Plain string: the secret value is used directly as the API key. | ||
| - JSON object: if the secret value parses as a JSON object containing a `dd_api_key` field, the value of that field is extracted and used as the API key. This is convenient when the same secret stores multiple credentials (for example, alongside an app key or other tokens). |
There was a problem hiding this comment.
| - Plain string: the secret value is used directly as the API key. | |
| - JSON object: if the secret value parses as a JSON object containing a `dd_api_key` field, the value of that field is extracted and used as the API key. This is convenient when the same secret stores multiple credentials (for example, alongside an app key or other tokens). | |
| - **Plain string**: The extension uses the secret value as the API key. | |
| - **JSON object**: If the secret value parses as a JSON object containing a `dd_api_key` field, the extension extracts that field's value and uses it as the API key. This is useful when the same secret stores multiple credentials (for example, alongside an app key or other tokens). |
| ```sh | ||
| { "dd_api_key": "<YOUR_DATADOG_API_KEY>" } | ||
| ``` | ||
| Attention: If the JSON object does not contain a `dd_api_key` field, or the value is not valid JSON, the extension falls back to using the raw secret string. The JSON key name is fixed as dd_api_key and is not configurable. |
There was a problem hiding this comment.
| Attention: If the JSON object does not contain a `dd_api_key` field, or the value is not valid JSON, the extension falls back to using the raw secret string. The JSON key name is fixed as dd_api_key and is not configurable. | |
| **Note**: If the JSON object does not contain a `dd_api_key` field, or the value is not valid JSON, the extension falls back to using the raw secret string. The JSON key name is fixed as `dd_api_key` and is not configurable. |
| ```sh | ||
| { "dd_api_key": "<YOUR_DATADOG_API_KEY>" } | ||
| ``` |
There was a problem hiding this comment.
Is json correct? If not, spell out shell instead of sh
| ```sh | |
| { "dd_api_key": "<YOUR_DATADOG_API_KEY>" } | |
| ``` | |
| ```json | |
| { "dd_api_key": "<YOUR_DATADOG_API_KEY>" } | |
| ``` |
What does this PR do? What is the motivation?
Merge instructions
Merge readiness:
For Datadog employees:
Your branch name MUST follow the
<name>/<description>convention and include the forward slash (/). Without this format, your pull request will not pass CI, the GitLab pipeline will not run, and you won't get a branch preview. Getting a branch preview makes it easier for us to check any issues with your PR, such as broken links.If your branch doesn't follow this format, rename it or create a new branch and PR.
[6/5/2025] Merge queue has been disabled on the documentation repo. If you have write access to the repo, the PR has been reviewed by a Documentation team member, and all of the required checks have passed, you can use the Squash and Merge button to merge the PR. If you don't have write access, or you need help, reach out in the #documentation channel in Slack.
AI assistance
Additional notes