refined-advantage-4379
08/19/2025, 10:25 PMtall-airline-16756
08/19/2025, 10:25 PMtall-airline-16756
08/19/2025, 10:26 PMconst output = new EncodedFileOutput({
fileType: EncodedFileType.MP4,
filepath: 'my-recording.mp4',
output: {
case: 's3',
value: new S3Upload({
accessKey: 'your-access-key', // Needed for the AssumeRole call
secret: 'your-secret-key', // Needed for the AssumeRole call
assumeRoleArn: 'arn:aws:iam::123456789012:role/LiveKitEgressRole',
assumeRoleExternalId: 'optional-external-id',
region: 'us-west-2',
bucket: 'my-bucket',
}),
},
});
Server-Side Configuration:
s3_assume_role_key: "your-access-key"
s3_assume_role_secret: "your-secret-key"
s3_assume_role_arn: "arn:aws:iam::123456789012:role/LiveKitEgressRole"
s3_assume_role_external_id: "optional-external-id"
Once you set this up server-side, the service will automatically use these credentials to assume the role whenever you include an assume_role_arn
in your request. Pretty handy, right?
Just a heads up: This feature needs to be enabled on your LiveKit Cloud account. If it’s not, you might run into an error. So, it’s a good idea to double-check that it’s active for you.
Sources: auth/grants_test.go | README.md | s3.gorefined-advantage-4379
08/19/2025, 10:29 PMtall-airline-16756
08/19/2025, 10:30 PMassume_role_arn
field. This way, LiveKit can step in and access your S3 bucket smoothly.
If you’d like a hand setting up the IAM role or tweaking those egress settings, just give me a shout—I’m here to help!
Sources: Infrastructure & Deployment | livekit/livekit_composite | DeepWiki | livekit/livekit_egress.pb.go | cmd/lk/examples/auto-track-egress.jsonrefined-advantage-4379
08/19/2025, 10:32 PMtall-airline-16756
08/19/2025, 10:33 PMassume_role_arn
of the IAM role instead of access keys.
Just a heads up: this feature needs to be enabled on your LiveKit Cloud account. Let me know if it’s active, and I’ll happily walk you through setting up the trust policy!
Sources: livekit/livekit_egress.pb.go | config.gorefined-advantage-4379
08/19/2025, 10:35 PMtall-airline-16756
08/19/2025, 10:36 PMrefined-advantage-4379
08/19/2025, 10:38 PMtall-airline-16756
08/19/2025, 10:38 PMassume_role_arn
of your IAM role. Here’s an example:
{
"s3": {
"assume_role_arn": "arn:aws:iam::123456789012:role/YourRoleName",
"assume_role_external_id": "your-external-id",
"bucket": "your-bucket-name",
"region": "your-region"
}
}
If you want a hand with any of these steps or need a bit more detail on setting up the trust policy, just let me know—I’m here to help!refined-advantage-4379
08/22/2025, 7:32 PMtall-airline-16756
08/22/2025, 7:32 PMmysterious-artist-97770
08/22/2025, 7:34 PMtall-airline-16756
08/22/2025, 7:35 PMfrom livekit import api
from livekit.protocol import egress
# Create the egress client
egress_client = api.EgressService(
host="your-livekit-host",
api_key="your-api-key",
api_secret="your-api-secret"
)
# Configure S3 upload with AssumeRole
s3_upload = egress.S3Upload(
access_key="your-access-key", # This is used to make the AssumeRole API call
secret="your-secret-key", # This is also for the AssumeRole API call
assume_role_arn="arn:aws:iam::123456789012:role/EgressUploadRole", # The ARN of the role you want to assume
assume_role_external_id="your-external-id", # Optional: adds extra security with ExternalID
region="us-west-2",
bucket="your-destination-bucket"
)
# Set up the file output with S3 upload
file_output = egress.EncodedFileOutput(
file_type=egress.EncodedFileType.MP4,
filepath="recordings/{room_name}-{time}.mp4",
s3=s3_upload
)
# Start the room composite egress
request = egress.RoomCompositeEgressRequest(
room_name="your-room-name",
file_outputs=[file_output]
)
# Send off the egress request
response = egress_client.start_room_composite_egress(request)
print(f"Egress started with ID: {response.egress_id}")
If you want me to walk you through any part of this or need examples for other egress types, just let me know—I’m here to help!
Sources: egress/redact.go | livekit-protocol/livekit/protocol/egress.pyi | README.mdmysterious-artist-97770
08/22/2025, 7:40 PMtall-airline-16756
08/22/2025, 7:40 PMrefined-advantage-4379
08/22/2025, 7:41 PMtall-airline-16756
08/22/2025, 7:41 PMfrom livekit import api
from livekit.protocol import egress
# Create the egress client
egress_client = api.EgressService(
host="your-livekit-host",
api_key="your-api-key",
api_secret="your-api-secret"
)
# Configure S3 upload with AssumeRole (no access keys or secrets needed)
s3_upload = egress.S3Upload(
assume_role_arn="arn:aws:iam::123456789012:role/EgressUploadRole", # ARN of the role to assume
assume_role_external_id="your-external-id", # Optional: ExternalID for extra security
region="us-west-2",
bucket="your-destination-bucket"
)
# Set up the file output with S3 upload
file_output = egress.EncodedFileOutput(
file_type=egress.EncodedFileType.MP4,
filepath="recordings/{room_name}-{time}.mp4",
s3=s3_upload
)
# Start room composite egress
request = egress.RoomCompositeEgressRequest(
room_name="your-room-name",
file_outputs=[file_output]
)
# Submit the egress request
response = egress_client.start_room_composite_egress(request)
print(f"Egress started with ID: {response.egress_id}")
With this setup, LiveKit Cloud will handle assuming the IAM role directly using the trust policy, so you don’t have to worry about managing access keys and secrets. If you have any questions or need a hand with anything else, just let me know!mysterious-artist-97770
08/22/2025, 8:18 PMtall-airline-16756
08/22/2025, 8:19 PMpip install livekit-api>=1.0.5
If you run into any problems after updating, just give me a shout—I’m here to help you troubleshoot or guide you through the setup.
Sources: livekit-rtc/livekit/rtc/version.py | Egress API | LiveKit Docsmysterious-artist-97770
08/22/2025, 8:51 PMtall-airline-16756
08/22/2025, 8:51 PMEgressService
isn’t directly accessible as livekit.api.EgressService
. Instead, you’ll want to use it through the LiveKitAPI
class. Here’s how you can do it:
from livekit.api import LiveKitAPI
# Initialize the API client
lkapi = LiveKitAPI(
url="your-livekit-url",
api_key="your-api-key",
api_secret="your-api-secret"
)
# Access egress methods
egress_info = lkapi.egress.start_room_composite_egress(request)
If you have any questions or need a hand with this setup, just give me a shout!
Sources: livekit-api/livekit/api/py.typed