Hey there! If you’re looking to deploy your containerized Python agent to AWS ECS using the EC2 launch type, here’s a friendly rundown of what you’ll need to do and keep in mind:
•
Infrastructure Setup: Start with a CloudFormation template to set up your VPC, ECS cluster, and security groups. Don’t forget to add EC2 instances, an Auto Scaling Group, and use an ECS-optimized AMI to keep things smooth.
•
Task Definition: You’ll want to tweak the task definition so it uses the EC2 launch type instead of Fargate. Also, adjust the CPU and memory settings to fit your EC2 instance types nicely.
•
Auto-Scaling: Set up auto-scaling policies based on CPU or memory usage. For voice agents, it’s best to scale up quickly and have longer cooldown periods when scaling down.
•
Load Balancer: Usually, agents don’t need external load balancers for job distribution, but you can definitely use one for health checks or if you have other endpoints exposed.
•
Container Requirements: Build your Docker image using the recommended base image and manage dependencies carefully. Make sure it runs as an unprivileged user and pre-downloads models during build time for better performance.
If you’d like, I can walk you through modifying the CloudFormation template, setting up auto-scaling policies, or configuring a load balancer for specific endpoints—just let me know!
Sources:
Deployment and scaling | LiveKit Docs |
Deployment and scaling | LiveKit Docs |
Infrastructure & Deployment | livekit/livekit_composite | DeepWiki |
python-agent-example-app/README.md