Skip to content

🎥 Make videos programmatically with React

Update PutRetentionPolicyCommand to allow retentionInDays as a param

Viren Mohindraf8da370c5d6e
diff --git a/packages/lambda/src/api/create-function.ts b/packages/lambda/src/api/create-function.ts
index d4e4ed54b2..15a25f4fce 100644
--- a/packages/lambda/src/api/create-function.ts
+++ b/packages/lambda/src/api/create-function.ts
@@ -7,10 +7,7 @@ import {
PutFunctionEventInvokeConfigCommand,
} from '@aws-sdk/client-lambda';
import {readFileSync} from 'fs';
-import {
- DEFAULT_CLOUDWATCH_RETENTION_PERIOD,
- LOG_GROUP_PREFIX,
-} from '../defaults';
+import { LOG_GROUP_PREFIX } from '../defaults';
import {AwsRegion} from '../pricing/aws-regions';
import {getCloudWatchLogsClient, getLambdaClient} from '../shared/aws-clients';
import {hostedLayers} from '../shared/hosted-layers';
@@ -25,6 +22,7 @@ export const createFunction = async ({
memorySizeInMb,
timeoutInSeconds,
alreadyCreated,
+ retentionInDays,
}: {
createCloudWatchLogGroup: boolean;
region: AwsRegion;
@@ -34,6 +32,7 @@ export const createFunction = async ({
memorySizeInMb: number;
timeoutInSeconds: number;
alreadyCreated: boolean;
+ retentionInDays: number;
}): Promise<{FunctionName: string}> => {
if (createCloudWatchLogGroup) {
try {
@@ -52,7 +51,7 @@ export const createFunction = async ({
await getCloudWatchLogsClient(region).send(
new PutRetentionPolicyCommand({
logGroupName: `${LOG_GROUP_PREFIX}${functionName}`,
- retentionInDays: DEFAULT_CLOUDWATCH_RETENTION_PERIOD,
+ retentionInDays,
})
);
}