Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Commit ca88240

Browse files
committed
upgrade lambda runtime and restrict dynamodb access for lambda
1 parent 4fd672d commit ca88240

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

posts/api/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ export class PostsApi extends Resource {
4949
"Statement": [
5050
{
5151
"Action": [
52-
"dynamodb:*"
52+
"dynamodb:Scan",
53+
"dynamodb:Query",
54+
"dynamodb:BatchGetItem",
55+
"dynamodb:GetItem",
56+
"dynamodb:PutItem",
5357
],
5458
"Resource": options.table.arn,
5559
"Effect": "Allow"
@@ -69,7 +73,7 @@ export class PostsApi extends Resource {
6973
const lambda = new aws.LambdaFunction(this, "api", {
7074
functionName: `sls-example-posts-api-${options.environment}`,
7175
handler: 'index.handler',
72-
runtime: 'nodejs10.x',
76+
runtime: 'nodejs14.x',
7377
role: role.arn,
7478
filename: code.asset.path,
7579
sourceCodeHash: code.asset.assetHash,

0 commit comments

Comments
 (0)