Skip to content

Commit

Permalink
docs: recommend lambda runtime nodejs12.x (#12807)
Browse files Browse the repository at this point in the history
Follow-up to #12713
This PR recommends NODEJS_12_X instead of NODEJS_10_X in aws-cdk READMEs.

Reasons for recommending NODEJS_12_X:
* Node.js 10.x is going end-of-life on April 30th, 2021
* Node.js 12.x went LTS in October 2019, and has been actively supported till October 2020.
* Node.js 14.x went LTS in October 2020, and is now actively supported LTS version.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
trivikr authored Feb 23, 2021
1 parent 3599247 commit ed86c66
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-apigateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ The following example shows how to use an API Key with a usage plan:

```ts
const hello = new lambda.Function(this, 'hello', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'hello.handler',
code: lambda.Code.fromAsset('lambda')
});
Expand Down Expand Up @@ -230,7 +230,7 @@ The following example shows how to use a rate limited api key :

```ts
const hello = new lambda.Function(this, 'hello', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'hello.handler',
code: lambda.Code.fromAsset('lambda')
});
Expand Down Expand Up @@ -260,7 +260,7 @@ have to define your models and mappings for the request, response, and integrati

```ts
const hello = new lambda.Function(this, 'hello', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'hello.handler',
code: lambda.Code.fromAsset('lambda')
});
Expand Down
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-cloudfront/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ The following shows a Lambda@Edge function added to the default behavior and tri

```ts
const myFunc = new cloudfront.experimental.EdgeFunction(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
});
Expand Down Expand Up @@ -310,7 +310,7 @@ If the stack is in `us-east-1`, a "normal" `lambda.Function` can be used instead

```ts
const myFunc = new lambda.Function(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
});
Expand All @@ -321,14 +321,14 @@ you can also set a specific stack ID for each Lambda@Edge.

```ts
const myFunc1 = new cloudfront.experimental.EdgeFunction(this, 'MyFunction1', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler1')),
stackId: 'edge-lambda-stack-id-1'
});

const myFunc2 = new cloudfront.experimental.EdgeFunction(this, 'MyFunction2', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler2')),
stackId: 'edge-lambda-stack-id-2'
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudtrail/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ configures logging of Lambda data events for a specific Function.
```ts
const trail = new cloudtrail.Trail(this, 'MyAmazingCloudTrail');
const amazingFunction = new lambda.Function(stack, 'AnAmazingFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: "hello.handler",
code: lambda.Code.fromAsset("lambda"),
});
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-codepipeline-actions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ const lambdaCode = lambda.Code.fromCfnParameters();
const func = new lambda.Function(lambdaStack, 'Lambda', {
code: lambdaCode,
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
});
// used to make sure each CDK synthesis produces a different Version
const version = func.addVersion('NewVersion');
Expand Down Expand Up @@ -921,7 +921,7 @@ import * as lambda from '@aws-cdk/aws-lambda';
const lambdaInvokeAction = new codepipeline_actions.LambdaInvokeAction({
actionName: 'Lambda',
lambda: new lambda.Function(this, 'Func', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromInline(`
const AWS = require('aws-sdk');
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-cognito/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ on the construct, as so -

```ts
const authChallengeFn = new lambda.Function(this, 'authChallengeFn', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromInline('auth challenge'),
});
Expand All @@ -357,7 +357,7 @@ const userpool = new cognito.UserPool(this, 'myuserpool', {
});

userpool.addTrigger(cognito.UserPoolOperation.USER_MIGRATION, new lambda.Function(this, 'userMigrationFn', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromInline('user migration'),
}));
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ import * as targets from '@aws-cdk/aws-events-targets';
const evalComplianceFn = new lambda.Function(this, 'CustomFunction', {
code: lambda.AssetCode.fromInline('exports.handler = (event) => console.log(event);'),
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
});

// A custom rule that runs on configuration changes of EC2 instances
Expand Down
14 changes: 7 additions & 7 deletions packages/@aws-cdk/aws-lambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as lambda from '@aws-cdk/aws-lambda';
import * as path from 'path';

const fn = new lambda.Function(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
});
Expand Down Expand Up @@ -88,7 +88,7 @@ function. To reference the autogenerated Role:

```ts
const fn = new lambda.Function(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),

Expand All @@ -101,7 +101,7 @@ it appropriate permissions:
```ts
const fn = new lambda.Function(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
role: myRole // user-provided role
Expand Down Expand Up @@ -251,7 +251,7 @@ setting the `deadLetterQueueEnabled: true` configuration.
import * as lambda from '@aws-cdk/aws-lambda';

const fn = new lambda.Function(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromInline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'),
deadLetterQueueEnabled: true
Expand All @@ -266,7 +266,7 @@ import * as sqs from '@aws-cdk/aws-sqs';

const dlq = new sqs.Queue(this, 'DLQ');
const fn = new lambda.Function(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromInline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'),
deadLetterQueue: dlq
Expand All @@ -282,7 +282,7 @@ to learn more about AWS Lambdas and DLQs.
import * as lambda from '@aws-cdk/aws-lambda';

const fn = new lambda.Function(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromInline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'),
tracing: lambda.Tracing.ACTIVE
Expand Down Expand Up @@ -321,7 +321,7 @@ to learn more about AWS Lambda's Profiling support.
import * as lambda from '@aws-cdk/aws-lambda';

const fn = new lambda.Function(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromInline('exports.handler = function(event, ctx, cb) { return cb(null, "hi"); }'),
reservedConcurrentExecutions: 100
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-rds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ const cluster = new rds.ServerlessCluster(this, 'AnotherCluster', {
});

const fn = new lambda.Function(this, 'MyFunction', {
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
handler: 'index.handler',
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda-handler')),
environment: {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-sns-subscriptions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import * as subscriptions from '@aws-cdk/aws-sns-subscriptions';

const myFunction = new lambda.Function(this, 'Echo', {
handler: 'index.handler',
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
code: lambda.Code.fromInline(`exports.handler = ${handler.toString()}`)
});

Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-stepfunctions-tasks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ const convertToSeconds = new tasks.EvaluateExpression(this, 'Convert to seconds'
const createMessage = new tasks.EvaluateExpression(this, 'Create message', {
// Note: this is a string inside a string.
expression: '`Now waiting ${$.waitSeconds} seconds...`',
runtime: lambda.Runtime.NODEJS_10_X,
runtime: lambda.Runtime.NODEJS_12_X,
resultPath: '$.message',
});

Expand All @@ -213,7 +213,7 @@ new sfn.StateMachine(this, 'StateMachine', {

The `EvaluateExpression` supports a `runtime` prop to specify the Lambda
runtime to use to evaluate the expression. Currently, the only runtime
supported is `lambda.Runtime.NODEJS_10_X`.
supported is `lambda.Runtime.NODEJS_12_X`.


## Athena
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ Usage of output in a CDK stack
const fn = new lambda.Function(this, "fn", {
handler: "index.handler",
code: lambda.Code.fromInline(`exports.handler = \${handler.toString()}`),
runtime: lambda.Runtime.NODEJS_10_X
runtime: lambda.Runtime.NODEJS_12_X
});

new cdk.CfnOutput(this, 'FunctionArn', {
Expand Down

0 comments on commit ed86c66

Please sign in to comment.