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

performance: move log group filters to invoker #77

Merged
merged 7 commits into from
Aug 6, 2024

Conversation

dasfmi
Copy link
Collaborator

@dasfmi dasfmi commented Aug 6, 2024

Moved the env variables to invoker, and used the ResourceProperties instead to get these values. This avoids modifying the Lambda environment variables, which used to force a Lambda function update by CloudFormation and prolongs the whole process.

context:

Another thing, just as a suggestion from a performance perspective: it might be beneficial to provide CloudWatchLogGroupsNames, CloudWatchLogGroupsPrefix, and CloudWatchLogGroupsPattern to the Custom Resource instead of passing them to Lambda function as environment variables. CloudFormation includes the Custom Resource properties in the payload sent to Lambda, so you can read them from the event (from the ResourceProperties property) in the code. This avoids modifying the Lambda environment variables, which forces a Lambda function update by CloudFormation and prolongs the whole process.

This PR also changes the parameters to remove the s in Groups to be consistent, e.g: CloudWatchLogGroupNames instead of CloudWatchLogGroupsNames

Moved the env variables to invoker, and used the ResourceProperties
instead to get these values. This avoids modifying the Lambda environment variables, which used to force a Lambda function update by CloudFormation and prolongs the whole process.
@dasfmi dasfmi force-pushed the improve-update-stack-performance branch from 731b584 to 4a6bdf6 Compare August 6, 2024 11:51
Copy link
Collaborator

@a-khaledf a-khaledf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

dasfmi added 4 commits August 6, 2024 17:37
When invoking a Delete event, the lambda recreates the log group after
its deleted. Causing errors on re-installing the stack. This ensures the
log groups are deleted and not re-created on Delete event.
@dasfmi dasfmi force-pushed the improve-update-stack-performance branch from b9877c7 to 3e0ad38 Compare August 6, 2024 14:57
@dasfmi dasfmi force-pushed the improve-update-stack-performance branch from b8c53ee to eeacf30 Compare August 6, 2024 15:25
@dasfmi dasfmi merged commit 4fb3b47 into main Aug 6, 2024
2 checks passed
@dasfmi dasfmi deleted the improve-update-stack-performance branch August 6, 2024 15:32
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.

2 participants