Skip to content

Commit

Permalink
python function cdk updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Kedharkb committed Mar 17, 2024
1 parent 2b2b325 commit fe62558
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
9 changes: 6 additions & 3 deletions infrastructure/lib/stacks/api-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ import * as cdk from 'aws-cdk-lib';
import {Duration} from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { Function, InlineCode, Runtime, Code, LayerVersion } from 'aws-cdk-lib/aws-lambda';
import { PythonFunction } from "@aws-cdk/aws-lambda-python-alpha";

export class ApiStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);


new Function(this, 'ApiLambda', {
new PythonFunction(this, 'ApiLambda', {
runtime: Runtime.PYTHON_3_10,
handler: 'main.lambda_handler',
code: Code.fromAsset('../src/lambdas/api_lambda/'),
handler: 'lambda_handler',
// code: Code.fromAsset('../src/lambdas/api_lambda/'),
entry: "../src/lambdas/api_lambda",
index: "main.py",
timeout: Duration.minutes(5),
});
}
Expand Down
13 changes: 13 additions & 0 deletions infrastructure/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion infrastructure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
"typescript": "~5.3.3"
},
"dependencies": {
"@aws-cdk/aws-lambda-python-alpha": "^2.133.0-alpha.0",
"aws-cdk-lib": "^2.133.0",
"constructs": "^10.0.0",
"source-map-support": "^0.5.21"
}
}
}

0 comments on commit fe62558

Please sign in to comment.