Chapter 460: Authenticating Lambda with EC2
Core Idea
EC2 instances have credentials that can interact with the AWS SDK. If you would like to use it with Remotion Lambda, you need to assume the role using STS to generate an access token that can be used by Remotion.
Key Concepts
- Prerequisites
- Setup for ec2-remotion-lambda application
- 1. Create the Remotion policy
- 2. Create role for remotion render execution
- 3. Create a role for the EC2 instance
- Steps
- 4. Trust the EC2 role from "remotion-ec2-executionrole"
- 6. Create the EC2 instance
Code Examples
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
},
"Action": "sts:AssumeRole"
},
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::XXXXXXXX:role/ec2-remotion-role"
},
"Action": "sts:AssumeRole"
}
]
}
- What it demonstrates: Usage pattern for Authenticating Lambda with EC2 from the official docs.
Key Takeaways
- Understand prerequisites when working with Authenticating Lambda with EC2.
- Understand setup for ec2-remotion-lambda application when working with Authenticating Lambda with EC2.
- Understand 1. create the remotion policy when working with Authenticating Lambda with EC2.
- Understand 2. create role for remotion render execution when working with Authenticating Lambda with EC2.
- Understand 3. create a role for the ec2 instance when working with Authenticating Lambda with EC2.
Connects To
- api: related page in the Lambda (@remotion/lambda) section.
- Approuterwebhook: related page in the Lambda (@remotion/lambda) section.
- Authentication: related page in the Lambda (@remotion/lambda) section.