Skip to content

Commit c115d7b

Browse files
author
Matt C
committed
python logic
1 parent c7de6c8 commit c115d7b

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
-e .
2+
aws-cdk.core==1.76.0
3+
aws-cdk.aws_apigatewayv2==1.76.0
4+
aws-cdk.aws-apigatewayv2-integrations==1.76.0
5+
aws-cdk.aws-lambda==1.76.0
6+
path==13.1.0
Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1-
from aws_cdk import core
1+
from aws_cdk import (
2+
aws_lambda as _lambda,
3+
aws_apigatewayv2 as api_gw,
4+
aws_apigatewayv2_integrations as integrations,
5+
core
6+
)
7+
import os
28

39

410
class ThePredictiveLambdaStack(core.Stack):
511

612
def __init__(self, scope: core.Construct, construct_id: str, **kwargs) -> None:
713
super().__init__(scope, construct_id, **kwargs)
814

9-
# The code that defines your stack goes here
15+
# defines an AWS Lambda resource
16+
model_folder = os.path.dirname(os.path.realpath(__file__)) + "/../model"
17+
predictive_lambda = _lambda.DockerImageFunction(self, 'PredictiveLambda',
18+
code=_lambda.DockerImageCode.from_image_asset(model_folder),
19+
memory_size=4096,
20+
timeout=core.Duration.seconds(15))
21+
# defines an API Gateway Http API resource backed by our "PredictiveLambda" function.
22+
api = api_gw.HttpApi(self, 'Endpoint',
23+
default_integration=integrations.LambdaProxyIntegration(handler=predictive_lambda));
24+
25+
core.CfnOutput(self, 'HTTP API Url', value=api.url);

0 commit comments

Comments
 (0)