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

feat(lambda): enable RuntimeManagementConfig #23891

Merged
merged 10 commits into from
Feb 6, 2023

Conversation

watany-dev
Copy link
Contributor

Introducing AWS Lambda runtime management controls
https://aws.amazon.com/jp/blogs/compute/introducing-aws-lambda-runtime-management-controls/

This setting achieves the following set values.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-functionruntimemanagementconfig

I have not been able to test this CFn as it does not seem to be supported by cdk. It's only a design.

Closes #23890.


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

@gitpod-io
Copy link

gitpod-io bot commented Jan 28, 2023

@aws-cdk-automation aws-cdk-automation requested a review from a team January 28, 2023 08:56
@github-actions github-actions bot added feature-request A feature should be added or improved. p2 star-contributor [Pilot] contributed between 25-49 PRs to the CDK labels Jan 28, 2023
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

@aws-cdk-automation aws-cdk-automation dismissed their stale review February 1, 2023 16:51

✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.

@watany-dev watany-dev marked this pull request as ready for review February 1, 2023 16:51
Copy link
Contributor

@comcalvi comcalvi left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, this looks pretty good. I'd prefer to keep this interface as flat props, since in most cases only one will need to be specified (I'm figuring most customers will prefer auto for runtime management)

packages/@aws-cdk/aws-lambda/README.md Outdated Show resolved Hide resolved
Comment on lines 32 to 46
export interface RuntimeManagement {
/**
* The ARN of the runtime version you want the function to use.
*
* Note.
* This is only required if you're using the Manual runtime update mode.
*
* @default none
*/
readonly arn?: string;
/**
* Specify the runtime update mode.
*/
readonly mode: UpdateRuntimeOn;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove this interface, and just have runtimeManagementVersionArn and runtimeManagementMode as props?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed this to flat.

if (props.runtimeManagement) {
if (props.runtimeManagement.mode === UpdateRuntimeOn.MANUAL) {
rmc = {
runtimeVersionArn: props.runtimeManagement.arn,
Copy link
Contributor

Choose a reason for hiding this comment

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

we need to throw an error if runtimeManagement.arn is not defined

* Sets the runtime management configuration for a function's version.
* @default Auto
*/
readonly runtimeManagement?: RuntimeManagement;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
readonly runtimeManagement?: RuntimeManagement;
readonly runtimeManagementMode?: RuntimeManagementMode;
readonly runtimeManagementVersionArn?: string;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implemented as specified in .manual(arn) of RuntimeManagementMode.

@comcalvi comcalvi self-assigned this Feb 2, 2023
@mergify mergify bot dismissed comcalvi’s stale review February 3, 2023 10:47

Pull request has been modified.

@watany-dev
Copy link
Contributor Author

watany-dev commented Feb 3, 2023

Thank you. I have applied the patches I could, but I will try again.
The ARN part is still being designed, but I feel it would be easier to set it up this way

runtimeManagementMode: UpdateRuntimeOn.MANUAL_ARN(<someArn>)

@comcalvi
Copy link
Contributor

comcalvi commented Feb 3, 2023

why UpdateRuntimeOn? It's not obvious from the name runtimeManagementMode that you would need to specify a UpdateRuntimeOn

@watany-dev
Copy link
Contributor Author

That is a fair point. I was using the original parameter names as they are, but I will consider a proposal to revise the naming to match.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-runtimemanagementconfig.html#cfn- lambda-function-runtimemanagementconfig-updateruntimeon

@watany-dev watany-dev requested review from comcalvi and removed request for aws-cdk-automation February 6, 2023 05:34
Copy link
Contributor

@comcalvi comcalvi left a comment

Choose a reason for hiding this comment

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

nice work! lgtm

@mergify
Copy link
Contributor

mergify bot commented Feb 6, 2023

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).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify mergify bot merged commit be4f971 into aws:main Feb 6, 2023
@mergify
Copy link
Contributor

mergify bot commented Feb 6, 2023

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. p2 star-contributor [Pilot] contributed between 25-49 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lambda: enable RuntimeManagementConfig
3 participants