Skip to content

πŸŽ₯ Make videos programmatically with React

Update usinglambdawithoutiamuser.md

Mehmetdedc301a9110
diff --git a/packages/docs/docs/lambda/usinglambdawithoutiamuser.md b/packages/docs/docs/lambda/usinglambdawithoutiamuser.md
index ffcafc7c37..1ce4f50896 100644
--- a/packages/docs/docs/lambda/usinglambdawithoutiamuser.md
+++ b/packages/docs/docs/lambda/usinglambdawithoutiamuser.md
@@ -10,45 +10,45 @@ import {UserPolicy} from '../../components/lambda/user-permissions.tsx';
## Context
-As documented on [`permission`](/docs/lambda/permissions) we create a remotion user and assign `policies`, this policies gives permissions to the `lambda` to render video from [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda). This approach is sometimes not acceptable as AWS client id and secret associated with the user are considered long term credentials and prone for inadvertent leakage.
+As documented on [`permission`](/docs/lambda/permissions) we create a Remotion user and assign `policies`. These policies give permission to Lambda to render a video with [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda). However, this approach poses security risks as the AWS access key ID and secret access key associated with the user are considered long-term credentials and could be inadvertently leaked. Additionally, there might be requirements to execute [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda) on services such as [`Lambda`](https://docs.aws.amazon.com/lambda/latest/dg/welcome.html), [`EC2`](https://aws.amazon.com/ec2/), and other [`computing services`](https://aws.amazon.com/products/compute/) where the use of long-term credentials is not an option.
-There also some that has requirements to execute the [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda) on services such as [`Lambda`](https://docs.aws.amazon.com/lambda/latest/dg/welcome.html), [`EC2`](https://aws.amazon.com/ec2/) and other [`compute services`](https://aws.amazon.com/products/compute/) which using the long term credentials is not an option. AWS has the concept of [IAM Roles](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles), when a role is assigned to a AWS service it assumes any elevated privileges from the attached AWS `policies`, it is empowered to execute activities such as putting a file to S3 bucket. The role is given short lived AWS credentials such as `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_SESSION_TOKEN`, to generate the video. With this approach security is enhanced as we don't have any long term credential lurking around and we don't need to keep track of it's rotation.
+AWS offers the concept of [IAM Roles](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles) as a solution to the problem above. When a role is assigned to an AWS service, AWS gives any elevated privileges based on the attached policies and the role is empowered to execute activities such as putting a file to an S3 bucket. The role is given temporary AWS credentials such as `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_SESSION_TOKEN` to generate the video. This approach enhances security as there are no long-term credentials lingering around and the need to keep track of their rotation is eliminated.
-The steps below provides authorization to the lambda function to execute `renderMediaOnLambda()` without permission issues.
+The steps below provide authorization for the Lambda function to execute `renderMediaOnLambda()` without permission issues.
## Prerequisites
-1. This assumes that you have deployed a `lambda` function running in AWS. An example is created in [`here`](https://github.com/alexfernandez803/example-lambda) using [`CDK`](https://docs.aws.amazon.com/cdk/v2/guide/work-with-cdk-typescript.html) to give you an idea how to call [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda) inside another a lambda function, the function is triggered by [API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html). This assumes that you have knowledge on using [`CDK`](https://docs.aws.amazon.com/cdk/v2/guide/work-with-cdk-typescript.html), a [write up](/docs/lambda/example-setup-without-iam-user) for this is also created for anyone to follow.
-2. Lambda execution role assigned to the lambda
-3. User Policy [user permissions](/docs/lambda/permissions#user-permissions).
+1. A deployed Lambda function running on AWS. An example that tells you how this is done is created [`here`](https://github.com/alexfernandez803/example-lambda) using [`CDK`](https://docs.aws.amazon.com/cdk/v2/guide/work-with-cdk-typescript.html). It gives you an idea how to call [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda) inside another Lambda function. The function is triggered by [API Gateway](https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html). The example assumes that you have knowledge of using [`CDK`](https://docs.aws.amazon.com/cdk/v2/guide/work-with-cdk-typescript.html), a [write up](/docs/lambda/example-setup-without-iam-user) for this is also created for anyone that wants to follow.
+2. An execution role is assigned to the Lambda function
+3. A user policy with the necessary [user permissions](/docs/lambda/permissions#user-permissions).
## Setup
#### 1. Create role policy
-- Go to AWS account IAM Policies section
+- Go to the IAM policies section in the AWS Management Console
- Click on "Create policy"
- Click on JSON
-- Copy the JSON Policy template below
+- Copy the JSON policy template below:
<details>
<summary>Show full role permissions JSON file for latest Remotion Lambda version
</summary>
<UserPolicy />
</details>
- Click next. On the tags page, you don't need to fill in anything. Click next again.
-- Give the policy exactly the name `remotion-executionrole-policy`. The other fields can be left as they are.
+- Give the policy the name `remotion-executionrole-policy`. The other fields can be left as they are.
-#### 2. Assign the policy to the Lamdba execution role
-- From your lambda function assign the policy to the lambda role execution role. To do so, go to the [AWS console](https://console.aws.amazon.com/console/home) ➞ [Lambda(change to your function region)](https://us-east-1.console.aws.amazon.com/lambda/home?region=us-east-1#/discover) ➞ [Functions](https://us-east-1.console.aws.amazon.com/lambda/home?region=us-east-1#/functions) ➞ Your lambda function ➞ Configuration tab ➞ Permissions tab ➞ Click the role under `Execution Role` ➞ When redirected, click Permissions tab ➞ Click Add permissions ➞ Attach policy ➞ Find the policy, ie `remotion-executionrole-policy` ➞ Select the policy ➞ Then click the attach policies button.
+#### 2. Assign the policy to the Lambda execution role
+- Go to the [AWS Management Console](https://console.aws.amazon.com/console/home) ➞ Navigate to [Lambda (change to your function region)](https://us-east-1.console.aws.amazon.com/lambda/home?region=us-east-1#/discover) ➞ [Functions](https://us-east-1.console.aws.amazon.com/lambda/home?region=us-east-1#/functions) ➞ Select your Lambda function ➞ Configuration tab ➞ Permissions tab ➞ Click the role under `Execution role` ➞ When redirected, click Permissions tab ➞ Click on `Add permissions` ➞ Attach policy ➞ Find the policy, i.e. `remotion-executionrole-policy` ➞ Select the policy ➞ Then click the `Attach policies` button.
-With the assignment of the `policy` to the lambda execution role, it is now empowered to execute the [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda), without permission issues. In the background, when the lambda function is executed it is provided with environment variables such as `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_SESSION_TOKEN` that has temporary permission to AWS resources that `renderMediaOnLambda()` requires to render the video. The elevated powers came from the policy statements in `remotion-executionrole-policy`.
+With the assignment of the `policy` to the Lambda execution role, it is now empowered to execute the [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda) without permission issues. In the background, when the Lambda function is executed, it is provided with environment variables such as `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_SESSION_TOKEN` that has temporary permission to AWS resources that `renderMediaOnLambda()` requires to render the video. The elevated powers came from the policy statements in `remotion-executionrole-policy`.
:::info
-This activity can be also applied to other AWS compute services such as `EC2`, `Fargate` etc..
+This procedure can be also applied to other AWS compute services such as `EC2`, `Fargate` etc..
:::
## Optional
-If you want to move the video to another s3 bucket when the video is rendered, the `lambda` also needs a permission to do so into the new bucket.
+If you want to move the video to another S3 bucket after it is rendered, the Lambda function also needs permission to do so. The process is similar to the previous steps, but you will need to create a new policy statement that defines the bucket that Lambda needs to transfer the rendered video to.
#### Example
```ts twoslash
@@ -69,12 +69,12 @@ If you want to move the video to another s3 bucket when the video is rendered, t
});
```
- From the example above, the `renderMediaOnLambda()` is configured to output the video to `transfer-to-this-bucket-after-render` bucket. The steps to allows the lambda to move the file to the other bucket, which is similar to [this](/docs/lambda/using-lambda-without-iam-user#setup).
+In the example above, the `renderMediaOnLambda()` is configured to output the rendered video to `transfer-to-this-bucket-after-render` bucket. The following steps allow Lambda to move the file to another bucket.
### Steps
-- From your lambda function assign the policy to the lambda execution role. To do so, go to the [AWS console](https://console.aws.amazon.com/console/home) ➞ [Lambda(change to your function region)](https://us-east-1.console.aws.amazon.com/lambda/home?region=us-east-1#/discover) ➞ [Functions](https://us-east-1.console.aws.amazon.com/lambda/home?region=us-east-1#/functions) ➞ Your lambda function ➞ Configuration tab ➞ Permissions tab ➞ Click the role under `Execution role` ➞ When redirected, click Permissions tab ➞ click `add permissions` ➞ Click create inline policy.
+- Again we assign the policy to the Lambda execution role. Go to the [AWS Management Console](https://console.aws.amazon.com/console/home) ➞ Navigate to [Lambda (change to your function region)](https://us-east-1.console.aws.amazon.com/lambda/home?region=us-east-1#/discover) ➞ [Functions](https://us-east-1.console.aws.amazon.com/lambda/home?region=us-east-1#/functions) ➞ Select your Lambda function ➞ Configuration tab ➞ Permissions tab ➞ Click the role under `Execution role` ➞ When redirected, click Permissions tab ➞ Click on `Add permissions` ➞ Click create inline policy.
- Click JSON tab
-- Add policy statement similar below defining the bucket the lambda needs to transfer the rendered video.
+- Add a policy statement similar to the one below, which is defining the bucket Lambda needs to transfer the rendered video to.
```json
{
@@ -93,10 +93,11 @@ If you want to move the video to another s3 bucket when the video is rendered, t
]
}
```
-- Click review policy
+- Replace {bucketname} with the name of the bucket where you want to move the rendered video to.
+- Click Click on `Review policy`
- Then click save changes
-The lambda function can now move the rendered video to the other bucket when render process is completed.
+The Lambda function can now move the rendered video to the other bucket when the render process is completed.
## See also
-- [Example setup without IAM user](/docs/lambda/example-setup-without-iam-user)
\ No newline at end of file
+- [Example setup without IAM user](/docs/lambda/example-setup-without-iam-user)