Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lambda): lambda does not set environment variables for AWS_CODEGURU_PROFILER properties when creating Amazon CodeGuruProfiler profiling group #28762

Merged
merged 8 commits into from
Jan 19, 2024

Conversation

ConnorRobertson
Copy link
Contributor

@ConnorRobertson ConnorRobertson commented Jan 18, 2024

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.

Closes #23511 .


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@ConnorRobertson ConnorRobertson self-assigned this Jan 18, 2024
@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p2 labels Jan 18, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team January 18, 2024 21:48
@ConnorRobertson ConnorRobertson marked this pull request as draft January 18, 2024 21:48
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jan 18, 2024
@ConnorRobertson ConnorRobertson marked this pull request as ready for review January 19, 2024 16:49
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 11747ea
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 19, 2024
Copy link
Contributor

mergify bot commented Jan 19, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 2511956 into aws:main Jan 19, 2024
14 checks passed
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 19, 2024
@ConnorRobertson ConnorRobertson deleted the aws-lambda-codeguru-fix branch January 31, 2024 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. contribution/core This is a PR that came from AWS. effort/small Small work item – less than a day of effort p2
Projects
None yet
3 participants