Skip to content

🎥 Make videos programmatically with React

enum

Jonny Burgerbcddb7df0ad9
diff --git a/packages/docs/docs/lambda/auto-delete-renderfiles.md b/packages/docs/docs/lambda/auto-delete-renderfiles.md
index 32afb1917a..b2c2c014e6 100644
--- a/packages/docs/docs/lambda/auto-delete-renderfiles.md
+++ b/packages/docs/docs/lambda/auto-delete-renderfiles.md
@@ -108,7 +108,7 @@ pnpm exec remotion lambda render testbed-v6 react-svg --log=verbose --render-fol
// @module: esnext
// @target: es2017
// ---cut---
-import { RenderExpiryDays, renderMediaOnLambda } from "@remotion/lambda/client";
+import { renderMediaOnLambda } from "@remotion/lambda/client";
const { bucketName, renderId } = await renderMediaOnLambda({
region: "us-east-1",
@@ -118,13 +118,13 @@ const { bucketName, renderId } = await renderMediaOnLambda({
"https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
codec: "h264",
colorSpace: "default",
- renderFolderExpiryInDays: RenderExpiryDays.AFTER_1_DAYS, // the generated file will be deleted after 1 day.
+ renderFolderExpiryInDays: "1-day", // the generated file will be deleted after 1 day.
});
```
## How it works
-By applying the AWS Lifecycle rules, we are instructing AWS S3 to delete files based on their prefixes. When `renderFolderExpiryInDays` is defined with a value of `RenderExpiryDays.AFTER_1_DAYS`, the render files will be placed into the `render/1days/` folder in S3, to which the deletion rule will be applied. The basis of the deletion is based on the `Last modified date` of the file/folder.
+By applying the AWS Lifecycle rules, we are instructing AWS S3 to delete files based on their prefixes. When `renderFolderExpiryInDays` is defined with a value of `"1-day"`, the render files will be placed into the `render/1-day/` folder in S3, to which the deletion rule will be applied. The basis of the deletion is based on the `Last modified date` of the file/folder.
<table>
<tr>
@@ -184,7 +184,7 @@ By applying the AWS Lifecycle rules, we are instructing AWS S3 to delete files b
<br/>
:::note
-AWS does not delete the file on exact time, but it will delete it!
+AWS does not delete the file at the exact time, but the deletion will happen.
:::
## Getting the progress of render
@@ -197,14 +197,14 @@ Due to AWS limitation on postfix search, we need to provide the `renderFolderExp
// @module: esnext
// @target: es2017
// ---cut---
-import { getRenderProgress, RenderExpiryDays } from "@remotion/lambda/client";
+import { getRenderProgress } from "@remotion/lambda/client";
const progress = await getRenderProgress({
renderId: "d7nlc2y",
bucketName: "remotionlambda-d9mafgx",
functionName: "remotion-render-la8ffw",
region: "us-east-1",
- renderFolderExpiryInDays: RenderExpiryDays.AFTER_1_DAYS,
+ renderFolderExpiryInDays: "7-days",
});
```
diff --git a/packages/lambda/src/functions/helpers/apply-lifecyle.ts b/packages/lambda/src/functions/helpers/apply-lifecyle.ts
index 51d4631d68..c9aa2ade01 100644
--- a/packages/lambda/src/functions/helpers/apply-lifecyle.ts
+++ b/packages/lambda/src/functions/helpers/apply-lifecyle.ts
@@ -6,17 +6,12 @@ import type {
export const deleteLifeCycleInput = ({
bucketName,
- lcRules,
}: {
bucketName: string;
- lcRules: LifecycleRule[];
}): DeleteBucketLifecycleCommandInput => {
return {
Bucket: bucketName,
- LifecycleConfiguration: {
- Rules: lcRules,
- },
- } as DeleteBucketLifecycleCommandInput;
+ };
};
export const createLifeCycleInput = ({
@@ -31,5 +26,5 @@ export const createLifeCycleInput = ({
LifecycleConfiguration: {
Rules: lcRules,
},
- } as PutBucketLifecycleConfigurationCommandInput;
+ };
};
diff --git a/packages/lambda/src/shared/lifecycle-rules.ts b/packages/lambda/src/shared/lifecycle-rules.ts
index edcd5536b0..c6dde21e98 100644
--- a/packages/lambda/src/shared/lifecycle-rules.ts
+++ b/packages/lambda/src/shared/lifecycle-rules.ts
@@ -10,7 +10,7 @@ import {
import {getLifeCycleRules} from '../functions/helpers/lifecycle';
import {getS3Client} from './aws-clients';
-export const createLCRules = async ({
+const createLCRules = async ({
bucketName,
region,
}: {
@@ -29,6 +29,21 @@ export const createLCRules = async ({
await getS3Client(region, null).send(createCommand);
};
+const deleteLCRules = async ({
+ bucketName,
+ region,
+}: {
+ bucketName: string;
+ region: AwsRegion;
+}) => {
+ const deleteCommandInput = deleteLifeCycleInput({
+ bucketName,
+ });
+ await getS3Client(region, null).send(
+ new DeleteBucketLifecycleCommand(deleteCommandInput),
+ );
+};
+
export const applyLifeCyleOperation = async ({
enableFolderExpiry,
bucketName,
@@ -48,19 +63,3 @@ export const applyLifeCyleOperation = async ({
await deleteLCRules({bucketName, region});
}
};
-
-export const deleteLCRules = async ({
- bucketName,
- region,
-}: {
- bucketName: string;
- region: AwsRegion;
-}) => {
- const lcRules = getLifeCycleRules();
- const deleteCommandInput = deleteLifeCycleInput({
- bucketName,
- lcRules,
- });
- const deleteCommand = new DeleteBucketLifecycleCommand(deleteCommandInput);
- await getS3Client(region, null).send(deleteCommand);
-};