Skip to content

Commit 36c6748

Browse files
committed
chore: update comments & confis
1 parent a20d43e commit 36c6748

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

examples/cdk/functions/put-item.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ const persistenceStore = new DynamoDBPersistenceLayer({
2525
});
2626
// Define the idempotency configuration
2727
const idempotencyConfig = new IdempotencyConfig({
28-
useLocalCache: false,
29-
maxLocalCacheSize: 500,
3028
expiresAfterSeconds: 60 * 60 * 24,
3129
});
3230

examples/cdk/src/function-with-logstream-construct.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import {
88
import { LogGroup, RetentionDays } from 'aws-cdk-lib/aws-logs';
99
import type { Construct } from 'constructs';
1010

11+
/**
12+
* The access mode for the table.
13+
*
14+
* Values are: read-only (RO) or read-write (RW)
15+
*/
1116
type AccessMode = 'RO' | 'RW';
1217

1318
type BindTableProps = {
@@ -32,6 +37,22 @@ type BindTableProps = {
3237
envVarName?: string;
3338
};
3439

40+
/**
41+
* Custom construct that extends the `NodejsFunction` construct to include a log group
42+
* as well as some default properties for the function and a helper method to bind the function to a DynamoDB table.
43+
*
44+
* The function is created with the following properties:
45+
* - `handler` set to `handler`
46+
* - `runtime` set to `Runtime.NODEJS_20_X`
47+
* - `tracing` set to `Tracing.ACTIVE`
48+
* - `architecture` set to `Architecture.ARM_64`
49+
* - `timeout` set to `Duration.seconds(30)`
50+
* - `environment` set to `{ NODE_OPTIONS: '--enable-source-maps' }`
51+
* - `logGroup` set to a new `LogGroup` with the log group name set to `/aws/lambda/${functionName}`
52+
*
53+
* By setting a custom log group, you can control the log retention policy and other log group settings
54+
* without having to deploy custom resources.
55+
*/
3556
export class FunctionWithLogGroup extends NodejsFunction {
3657
public constructor(scope: Construct, id: string, props: NodejsFunctionProps) {
3758
const { functionName } = props;

0 commit comments

Comments
 (0)