-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
55 lines (45 loc) · 1.69 KB
/
app.py
File metadata and controls
55 lines (45 loc) · 1.69 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
#!/usr/bin/env python3
import aws_cdk
from aws_cdk import CfnOutput, Stack, aws_lambda
from constructs import Construct
from python_lambda_function import PythonDockerLambdaFunction, PythonLambdaFunction
class LambdaStack(Stack):
def __init__(self, scope: Construct, construct_id: str, function_id: str, **kwargs) -> None:
super().__init__(scope, construct_id)
function = PythonLambdaFunction(self, function_id, **kwargs)
CfnOutput(self, "LambdaFunctionArn", value=function.function_arn)
class DockerLambdaStack(Stack):
def __init__(self, scope: Construct, construct_id: str, function_id: str, **kwargs) -> None:
super().__init__(scope, construct_id)
function = PythonDockerLambdaFunction(self, function_id, **kwargs)
CfnOutput(self, "LambdaFunctionArn", value=function.function_arn)
app = aws_cdk.App()
LambdaStack(
app,
"Lambda1Stack",
function_id="Lambda1",
path="..",
package_name="demo-lambda1",
handler="demo_lambda1.lambda_function.lambda_handler",
)
LambdaStack(
app,
"Lambda2Stack",
function_id="Lambda2",
path="..",
package_name="demo-lambda2",
handler="demo_lambda2.lambda_function.lambda_handler",
architecture=aws_lambda.Architecture.X86_64,
runtime=aws_lambda.Runtime.PYTHON_3_11,
bundling_docker_image="ghcr.io/astral-sh/uv:0.5.12-python3.11-bookworm@sha256:45635c2745b29dfbdeed1c6152f97c9042dd84b6eca8a8da61799afa9266d787",
)
DockerLambdaStack(
app,
"DockerLambda1Stack",
function_id="DockerLambda1",
path="..",
dockerfile="../packages/demo-lambda1/Dockerfile",
package_name="demo-lambda1",
handler="demo_lambda1.lambda_function.lambda_handler",
)
app.synth()