-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcdk-stack.ts
35 lines (30 loc) · 1.09 KB
/
cdk-stack.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import * as cdk from "@aws-cdk/core";
import { NodejsFunction } from "@aws-cdk/aws-lambda-nodejs";
import * as lambda from "@aws-cdk/aws-lambda";
import * as apig from "@aws-cdk/aws-apigateway";
export class CdkStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// Uncomment to use AWS Distro for OTel Lambda Layer
// const oTelLambdaLayer = lambda.LayerVersion.fromLayerVersionArn(
// this,
// "oTelLambdaLayer",
// "arn:aws:lambda:us-west-2:901920570463:layer:aws-otel-nodejs-ver-1-0-0:1"
// );
const server = new NodejsFunction(this, "ServerFunction", {
entry: "../src/server.ts",
handler: "handler",
memorySize: 1500,
// Uncomment to use AWS Distro for OTel Lambda Layer
// environment: {
// OTEL_LOG_LEVEL: "debug",
// AWS_LAMBDA_EXEC_WRAPPER: "/opt/otel-handler",
// },
// layers: [oTelLambdaLayer],
// tracing: lambda.Tracing.ACTIVE,
});
new apig.LambdaRestApi(this, "GraphQLAPI", {
handler: server,
});
}
}