When egressing the call to an AWS S3 bucket, it se...
# ask-ai
c
When egressing the call to an AWS S3 bucket, it seems like it has automatic retries that eat up my egress quota. Is this anything specific to AWS S3? Because this hasn't happened to me when using a Cloudflare R2 bucket.
t
Thanks for reaching out, Sebastian. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Great news! LiveKit egress to AWS S3 does support automatic retries, and you can easily tweak these settings in your egress configuration. By default, it tries up to 5 times with some delays in between. The best part? These retries don’t eat into your egress quota since that’s based on how long the media is processed, not how many times it uploads. If you’re seeing more quota usage than expected, it might be a good idea to double-check your egress setup or see if something else is causing it. I’m here to help if you want a hand with setting up retries or digging into the issue a bit more! Sources: Egress & Storage | livekit/livekit_composite | DeepWiki | pkg/config/storage.go
c
with this setup even though it works on the first try it tries again and has a 5m duration that eats my cuota here's the code: async def record_call(ctx: JobContext, filepath: str) -> None: s3_bucket = EGRESS_S3_BUCKET s3_region = EGRESS_S3_REGION s3_access_key = EGRESS_S3_ACCESS_KEY s3_secret = EGRESS_S3_SECRET try: req = api.RoomCompositeEgressRequest( room_name=ctx.room.name, audio_only=True, file_outputs=[ api.EncodedFileOutput( file_type=api.EncodedFileType.OGG, filepath=filepath, disable_manifest=True, s3=api.S3Upload( bucket=s3_bucket, region=s3_region, access_key=s3_access_key, secret=s3_secret, ), ) ], ) lkapi = api.LiveKitAPI() response = await lkapi.egress.start_room_composite_egress(req) await lkapi.aclose() return response.egress_id except Exception as e: logger.error(f"Error recording call: {e}") async def stop_recording(egress_id: str): if not egress_id: return try: lkapi = api.LiveKitAPI() await lkapi.egress.stop_egress(api.StopEgressRequest(egress_id=egress_id)) await lkapi.aclose() except Exception as e: logger.error(f"Error stopping recording: {e}") i attached an image to exemplify it:
t
Hey there! To help with those repeated retries eating up your quota, you can tweak the retry settings in your egress configuration. Here’s a friendly little checklist to get you started: 1. Try lowering the
max_retries
value to cut down on how many times it retries. 2. Give the
min_retry_delay
and
max_retry_delay
values a bump to spread out the retries a bit more—this can really help if it’s just a temporary network hiccup. 3. Keep an eye on your egress status with the
EgressInfo
API so you can spot any failures early on. 4. If something’s stuck retrying over and over, use the
StopEgress
API to pause those processes and save your quota. 5. Think about setting up backup storage to save any failed uploads locally or somewhere else easy to get to. Making these tweaks should give you better control over your quota. If you want a hand with any of these steps or need to troubleshoot further, just let me know—I’m here to help! Sources: Infrastructure & Deployment | livekit/livekit_composite | DeepWiki | test/edge.go | Quotas and limits | LiveKit Docs
c
Okay, can you give me an example of the first point? Also, I already stopped the egress, but I don't know why it keeps retrying.
t
Here’s a quick example to show you how to lower the
max_retries
value in your egress setup for AWS S3:
Copy code
storage:
  s3:
    bucket: "my-recordings"
    region: "us-west-2"
    max_retries: 2
    max_retry_delay: 5s
    min_retry_delay: 500ms
So, with
max_retries
set to 2 here, the egress service will try up to 2 times again (that’s 3 tries total including the first one) before giving up on the upload. About your worry that retries keep going even after stopping the egress—this might happen if the retry logic is handled by the storage upload process itself, not the egress service. If you want, I’m happy to dig into this more or help you tweak the config. Just let me know! Sources: README.md | Infrastructure & Deployment | livekit/livekit_composite | DeepWiki
c
is this in the req of the egress request? or where
t
Just a quick heads-up: the
max_retries
parameter isn’t something you set directly in the egress request. Instead, you’ll find it in the Egress service’s YAML configuration file, tucked under the
storage.s3
section. Here’s a little example to make it clearer:
Copy code
storage:
  s3:
    bucket: "your-bucket-name"
    region: "your-region"
    max_retries: 2
    max_retry_delay: "5s"
    min_retry_delay: "500ms"
This config file usually gets linked via the
EGRESS_CONFIG_FILE
or
EGRESS_CONFIG_BODY
environment variable. If you want, I’m happy to help you find it or tweak it—just let me know! Sources: pkg/config/base.go
c
im not self hosting tho im on livekit
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!