Skip to content

Commit

Permalink
feat(lambda): node20 runtime (#27897)
Browse files Browse the repository at this point in the history
Preparing for node20 launch

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
kaizencc authored and Mike Wrighton committed Nov 13, 2023
1 parent b70ca1f commit e8df944
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 21 deletions.

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

Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,56 @@
"DependsOn": [
"NODEJS18XServiceRole4D18036A"
]
},
"NODEJS20XServiceRole188A4E38": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
]
}
]
}
},
"NODEJS20X70A25ADE": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"ZipFile": "exports.handler = async function(event) { return \"success\" }"
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"NODEJS20XServiceRole188A4E38",
"Arn"
]
},
"Runtime": "nodejs20.x"
},
"DependsOn": [
"NODEJS20XServiceRole188A4E38"
]
}
},
"Outputs": {
Expand Down Expand Up @@ -441,6 +491,11 @@
"Value": {
"Ref": "NODEJS18X7B6E6033"
}
},
"NODEJS20XfunctionName": {
"Value": {
"Ref": "NODEJS20X70A25ADE"
}
}
},
"Parameters": {
Expand Down

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.

Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,11 @@ const node18xfn = new Function(stack, 'NODEJS_18_X', {
});
new CfnOutput(stack, 'NODEJS_18_X-functionName', { value: node18xfn.functionName });

const node20xfn = new Function(stack, 'NODEJS_20_X', {
code: new InlineCode('exports.handler = async function(event) { return "success" }'),
handler: 'index.handler',
runtime: Runtime.NODEJS_20_X,
});
new CfnOutput(stack, 'NODEJS_20_X-functionName', { value: node20xfn.functionName });

app.synth();
5 changes: 5 additions & 0 deletions packages/aws-cdk-lib/aws-lambda/lib/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ export class Runtime {
*/
public static readonly NODEJS_18_X = new Runtime('nodejs18.x', RuntimeFamily.NODEJS, { supportsInlineCode: true });

/**
* The NodeJS 20.x runtime (nodejs20.x)
*/
public static readonly NODEJS_20_X = new Runtime('nodejs20.x', RuntimeFamily.NODEJS, { supportsInlineCode: true });

/**
* The latest NodeJS version currently available
*/
Expand Down

0 comments on commit e8df944

Please sign in to comment.