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): add SnapStart support for arm64 functions #30898

Merged
merged 6 commits into from
Jul 19, 2024

Conversation

valerena
Copy link
Contributor

@valerena valerena commented Jul 19, 2024

Issue # (if applicable)

Closes #30899.

Reason for this change

Lambda released SnapStart support for arm64 functions: https://aws.amazon.com/about-aws/whats-new/2024/07/aws-lambda-snapstart-java-functions-arm64-architecture/

Description of changes

Allow configuring SnapStart on arm64 functions.

Description of how you validated changes

yarn test

Checklist


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

@aws-cdk-automation aws-cdk-automation requested a review from a team July 19, 2024 00:27
@github-actions github-actions bot added p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Jul 19, 2024
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.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@aws-cdk-automation aws-cdk-automation dismissed their stale review July 19, 2024 01:37

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

@valerena
Copy link
Contributor Author

In the meantime while this gets merged and officially released, people wanting to use SnapStart on their arm64 functions, need to use the workaround that was used before SnapStart was supported in the function L2 construct:
(based on #23153 (comment))

    const fn = new lambda.Function(this, 'Func', {
      runtime: lambda.Runtime.JAVA_21,
      handler: 'example.Handler',
      architecture: lambda.Architecture.ARM_64,
      code: lambda.Code.fromAsset(path.join(__dirname, '../../lambda/example.jar')),
      memorySize: 256,
    });

    // Workaround: Add SnapStart configuration like this:
    (fn.node.defaultChild as lambda.CfnFunction).addPropertyOverride('SnapStart', {
      ApplyOn: 'PublishedVersions',
    });

@github-actions github-actions bot added the feature-request A feature should be added or improved. label Jul 19, 2024
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 19, 2024
@@ -967,7 +967,7 @@ managing concurrency.

## Lambda with SnapStart

SnapStart is currently supported only on Java 11/Java 17 runtime. SnapStart does not support provisioned concurrency, the arm64 architecture, Amazon Elastic File System (Amazon EFS), or ephemeral storage greater than 512 MB. After you enable Lambda SnapStart for a particular Lambda function, publishing a new version of the function will trigger an optimization process.
SnapStart is currently supported only on Java 11/Java 17 runtime. SnapStart does not support provisioned concurrency, Amazon Elastic File System (Amazon EFS), or ephemeral storage greater than 512 MB. After you enable Lambda SnapStart for a particular Lambda function, publishing a new version of the function will trigger an optimization process.
Copy link

Choose a reason for hiding this comment

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

SnapStart is also available on Java 21.

You might want to flip this around to say "SnapStart is not available on Java 8 (AL1 or AL2)" or words to that effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to mention that it's only supported in Java, so we can't leave "just Java8" out of the support. (Yes, @msailes, there are other runtimes other than Java 😉)

The official documentation mentions "SnapStart supports Java 11 and later Java managed runtimes", so we can go with something like that.

xazhao
xazhao previously approved these changes Jul 19, 2024
Copy link
Contributor

@xazhao xazhao left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

mergify bot commented Jul 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).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 19, 2024
@mergify mergify bot dismissed xazhao’s stale review July 19, 2024 17:48

Pull request has been modified.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 19, 2024
Copy link
Contributor

mergify bot commented Jul 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).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Jul 19, 2024
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: e540091
  • 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 b4377a5 into aws:main Jul 19, 2024
12 checks passed
Copy link
Contributor

mergify bot commented Jul 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).

Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

obraafo pushed a commit to obraafo/aws-cdk that referenced this pull request Jul 25, 2024
### Issue # (if applicable)

Closes aws#30899.

### Reason for this change

Lambda released SnapStart support for arm64 functions: https://aws.amazon.com/about-aws/whats-new/2024/07/aws-lambda-snapstart-java-functions-arm64-architecture/



### Description of changes

Allow configuring SnapStart on arm64 functions.



### Description of how you validated changes



```yarn test```

### 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*
@aws-cdk-automation
Copy link
Collaborator

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

❗️NOTICE (lambda): SnapStart for Java functions using ARM64
5 participants