AWS EC2
Deploy your VideoSDK AI Agent Worker on AWS EC2 instances.
Prerequisites
- AWS account
- SSH key pair
- VideoSDK authentication token
Quick Setup
1. Launch EC2 Instance
aws ec2 run-instances \
--image-id ami-0c02fb55956c7d316 \
--instance-type t3.medium \
--key-name your-key-pair \
--security-group-ids sg-xxxxxxxxx \
--user-data file://user-data.sh
2. User Data Script
#!/bin/bash
yum update -y
yum install -y python3 python3-pip git
# Clone private repository with token
git clone https://YOUR_TOKEN@github.com/your-org/your-agent.git /opt/agent
cd /opt/agent
# Install dependencies
pip3 install -r requirements.txt
# Create systemd service
cat > /etc/systemd/system/agent-worker.service << EOF
[Unit]
Description=VideoSDK Agent Worker
After=network.target
[Service]
Type=simple
User=ec2-user
WorkingDirectory=/opt/agent
Environment=VIDEOSDK_AUTH_TOKEN=your_auth_token
ExecStart=/usr/bin/python3 main.py
Restart=always
[Install]
WantedBy=multi-user.target
EOF
# Start the service
systemctl enable agent-worker
systemctl start agent-worker
3. Security Group
Configure your security group with these rules:
- SSH (22): Your IP
- Custom TCP (8081): Your IP (for health checks)
- HTTPS (443): 0.0.0.0/0 (for VideoSDK API)
Deploy Updates
# Connect to your instance
ssh -i your-key.pem ec2-user@your-instance-ip
# Update your agent
cd /opt/agent
git pull
systemctl restart agent-worker
Monitor
# Check service status
systemctl status agent-worker
# View logs
journalctl -u agent-worker -f
Scaling
To support more concurrent agents, you can spin up additional EC2 instances using the same process. Each instance will register with the VideoSDK backend registry and automatically receive job assignments. The backend will distribute the load across all available workers.
To add more instances:
- Use the same user data script
- Launch additional EC2 instances
- Each instance will automatically join the worker pool
- The VideoSDK backend will handle load balancing
Example:
# Launch multiple instances
aws ec2 run-instances \
--image-id ami-0c02fb55956c7d316 \
--instance-type t3.medium \
--key-name your-key-pair \
--security-group-ids sg-xxxxxxxxx \
--user-data file://user-data.sh \
--count 3
Got a Question? Ask us on discord