Skip to content

Commit

Permalink
fix(lambda): lambda does not set environment variables for `AWS_CODEG…
Browse files Browse the repository at this point in the history
…URU_PROFILER` properties when creating Amazon CodeGuruProfiler profiling group (#28762)

> # Issue
> > When `{ profiling: true }` CDK creates a profiling group using autogenerated parameters which is never set as an environment variable. This causes another profiling group with default parameters to be created by the lambda. This can create permissions issues. This is an issue when the Lambda has Java or Python runtime but not other runtimes. 
> # Solution
> > For the python, corretto and jdk11 runtime, they will not look at
`AWS_CODEGURU_PROFILER_GROUP_ARN` and will only look at
`AWS_CODEGURU_PROFILER_GROUP_NAME` and `AWS_CODEGURU_PROFILER_TARGET_REGION`. Runtimes that support `AWS_CODEGURU_PROFILER_GROUP_ARN` prefer `AWS_CODEGURU_PROFILER_GROUP_NAME` and `AWS_CODEGURU_PROFILER_TARGET_REGION` and fallback onto the ARN. 
So the solution sets these values as potential environment variables.
> # Important Design Decisions
> > I changed profiling validation to not error and instead warn the user to have environment variables remain consistent with each other while having no backwards compatibility concerns.
>
> Remember to follow the [CONTRIBUTING GUIDE] and [DESIGN GUIDELINES] for any
> code you submit.
>
> [CONTRIBUTING GUIDE]: https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md
> [DESIGN GUIDELINES]: https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md

Closes #23511 .

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
ConnorRobertson committed Jan 19, 2024
1 parent 20ad55e commit 2511956
Show file tree
Hide file tree
Showing 19 changed files with 35,143 additions and 35 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2511956

Please sign in to comment.