Created
April 13, 2023 00:30
-
-
Save emileten/0ff150ae98c3f5e1beb5ceae96ec8477 to your computer and use it in GitHub Desktop.
request-python-lambda-construct
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from aws_cdk import aws_lambda, Stack, App | |
import aws_cdk.aws_lambda_python_alpha as aws_lambda_python | |
class LambdaStack(Stack): | |
def __init__(self, app, construct_id, **kwargs) -> None: | |
super().__init__(app, construct_id, **kwargs) | |
self.construct_id = construct_id | |
def python_lambda(name, directory, **kwargs): | |
return aws_lambda_python.PythonFunction( | |
scope=self, | |
id=name, | |
function_name=name, | |
entry=directory, | |
runtime=aws_lambda.Runtime.PYTHON_3_8, | |
index="handler.py", | |
handler="handler", | |
environment=None, | |
**kwargs, | |
) | |
request_lambda = python_lambda( | |
"request_lambda", | |
"..", | |
) | |
app = App() | |
lambda_stack = LambdaStack( | |
app, | |
"requestlambda", | |
) | |
app.synth() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment