Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(lambda): recommend a single source of truth for environment vari…
…ables (aws#33587) ### Issue # (if applicable) Closes #<issue number here>. This update improves the AWS Lambda component documentation in AWS CDK by recommending a single source of truth for environment variables. It addresses potential inconsistencies when defining environment variables separately in function code and infrastructure code, which can lead to mismatches during deployments. ### Reason for this change When updating a Lambda function in AWS CDK, CloudFormation applies configuration updates before code updates, which can temporarily cause environment variables to be removed or changed before the new function code is deployed. If the function executes during this period, it may fail due to missing or outdated environment variables. Defining environment variables in a single source of truth helps minimize inconsistencies and reduces the risk of deployment errors. ### Description of changes - Expanded documentation to emphasize defining environment variables centrally. - Clarified best practices for referencing environment variables in both the handler and infrastructure code. - Provided a recommendation to define environment variables in env.ts and reference them consistently. ### Describe any new or updated permissions being added ### Description of how you validated changes The updated recommendations were tested with a standard AWS CDK deployment to confirm that environment variables remain consistent across Lambda function executions. Ensured that the proposed approach aligns with AWS CDK’s best practices for maintainability and type safety. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information