-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstack.ts
More file actions
95 lines (89 loc) · 2.46 KB
/
stack.ts
File metadata and controls
95 lines (89 loc) · 2.46 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import path from "node:path";
import { type App, Duration, Stack, type StackProps } from "aws-cdk-lib";
import { Architecture, Runtime, Tracing } from "aws-cdk-lib/aws-lambda";
import { NodejsFunction, OutputFormat } from "aws-cdk-lib/aws-lambda-nodejs";
export const LambdaOrchestration = class extends Stack {
constructor(scope: App, id: string, props?: StackProps) {
super(scope, id, props);
const functionA = new NodejsFunction(
this,
"LambdaOrchestration-FunctionA",
{
architecture: Architecture.ARM_64,
bundling: {
format: OutputFormat.ESM,
minify: true,
sourceMap: true,
},
entry: path.join(__dirname, "./function-a.ts"),
functionName: "lambda-orchestration-function-a",
handler: "index.handler",
runtime: Runtime.NODEJS_24_X,
tracing: Tracing.ACTIVE,
},
);
const functionB = new NodejsFunction(
this,
"LambdaOrchestration-FunctionB",
{
architecture: Architecture.ARM_64,
bundling: {
format: OutputFormat.ESM,
minify: true,
sourceMap: true,
},
entry: path.join(__dirname, "./function-b.ts"),
functionName: "lambda-orchestration-function-b",
handler: "index.handler",
runtime: Runtime.NODEJS_24_X,
tracing: Tracing.ACTIVE,
},
);
const functionC = new NodejsFunction(
this,
"LambdaOrchestration-FunctionC",
{
architecture: Architecture.ARM_64,
bundling: {
format: OutputFormat.ESM,
minify: true,
sourceMap: true,
},
entry: path.join(__dirname, "./function-c.ts"),
functionName: "lambda-orchestration-function-c",
handler: "index.handler",
runtime: Runtime.NODEJS_24_X,
tracing: Tracing.ACTIVE,
},
);
const functionD = new NodejsFunction(
this,
"LambdaOrchestration-FunctionD",
{
architecture: Architecture.ARM_64,
bundling: {
format: OutputFormat.ESM,
minify: true,
sourceMap: true,
},
entry: path.join(__dirname, "./function-d.ts"),
environment: {
FUNCTION_A_ARN: functionA.functionArn,
FUNCTION_B_ARN: functionB.functionArn,
FUNCTION_C_ARN: functionC.functionArn,
},
durableConfig: {
executionTimeout: Duration.minutes(1),
retentionPeriod: Duration.days(1),
},
functionName: "lambda-orchestration-function-d",
handler: "index.handler",
runtime: Runtime.NODEJS_24_X,
tracing: Tracing.ACTIVE,
},
);
functionA.grantInvoke(functionD);
functionB.grantInvoke(functionD);
functionC.grantInvoke(functionD);
}
};