Containers
Deploy and manage containerized applications on AWS ECS.
Container deployments use AWS CloudFormation to provision dedicated EC2 instances. Deployments typically take 8-12 minutes to complete.
Prerequisites
Before deploying a container, you need to:
- Build and push your Docker image to ECR
- Get ECR credentials from
/api/v1/containers/credentials
Get ECR Credentials
Get temporary ECR credentials to push your Docker image.
Response
{
"success": true,
"credentials": {
"username": "AWS",
"password": "eyJwYXlsb2FkIjoiLi4uIiwiZGF0YWtleSI6Ii4uLiJ9",
"proxyEndpoint": "https://123456789.dkr.ecr.us-east-1.amazonaws.com",
"expiresAt": "2024-01-15T22:30:00Z"
},
"repository": {
"uri": "123456789.dkr.ecr.us-east-1.amazonaws.com/eliza-user-images",
"name": "eliza-user-images"
}
}List Containers
Get all containers for your organization.
Response
{
"success": true,
"data": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "my-agent-runtime",
"project_name": "my-project",
"status": "running",
"url": "https://my-project.containers.cloud.milady.ai",
"cpu": 1792,
"memory": 1792,
"port": 3000,
"architecture": "arm64",
"created_at": "2024-01-15T10:30:00Z"
}
]
}Create Container
Deploy a new container to AWS ECS. Returns immediately with a 202 Accepted status while deployment proceeds asynchronously.
Request
{
"name": "My Agent Runtime",
"project_name": "my-project",
"ecr_image_uri": "123456789.dkr.ecr.us-east-1.amazonaws.com/eliza-user-images:my-tag",
"port": 3000,
"cpu": 1792,
"memory": 1792,
"desired_count": 1,
"architecture": "arm64",
"health_check_path": "/health",
"environment_vars": {
"NODE_ENV": "production",
"LOG_LEVEL": "info"
}
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | ✓ | Display name (max 100 chars) |
project_name | string | ✓ | Project identifier (max 50 chars, used in URL) |
ecr_image_uri | string | ✓ | Full ECR image URI with tag |
port | integer | Container port. Default: 3000 | |
cpu | integer | CPU units (256-2048). Default: 1792 | |
memory | integer | Memory in MB (256-2048). Default: 1792 | |
desired_count | integer | Number of instances (1-10). Default: 1 | |
architecture | string | arm64 or x86_64. Default: arm64 | |
health_check_path | string | Health check endpoint. Default: /health | |
environment_vars | object | Environment variables (max 50 vars, 32KB per value) |
Response (202 Accepted)
{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "My Agent Runtime",
"project_name": "my-project",
"status": "pending"
},
"message": "Container deployment started. Poll GET /api/v1/containers/:id to check status.",
"creditsDeducted": 0.5,
"creditsRemaining": 49.5,
"stackName": "eliza-user-abc123-my-project",
"polling": {
"endpoint": "/api/v1/containers/550e8400-e29b-41d4-a716-446655440000",
"intervalMs": 10000,
"expectedDurationMs": 600000
}
}Container deployments require sufficient credits and are subject to organization quotas.
Get Container
Get container details and deployment status.
Container Status Values
| Status | Description |
|---|---|
pending | Deployment initiated |
building | Provisioning EC2 instance |
deploying | CloudFormation stack creating |
running | Container is healthy and accessible |
failed | Deployment failed (check error message) |
stopped | Container manually stopped |
Delete Container
Stop and delete a container. This terminates the EC2 instance and deletes the CloudFormation stack.
Container Logs
Get container logs from CloudWatch.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
tail | integer | Number of lines (default: 100) |
since | string | Start time (ISO 8601) |
Response
{
"logs": [
{
"timestamp": "2024-01-15T10:30:00Z",
"message": "Server started on port 3000"
}
]
}Stream Logs
Stream logs in real-time using Server-Sent Events.
Container Metrics
Get container resource metrics.
Response
{
"cpu": {
"usage": 15.5,
"limit": 100
},
"memory": {
"usage": 256,
"limit": 512,
"unit": "MB"
},
"network": {
"rx": 1024000,
"tx": 512000
}
}Container Health
Get container health status.
Response
{
"status": "healthy",
"checks": {
"http": "passing",
"memory": "passing",
"disk": "passing"
}
}Deployment Workflow
- Get ECR Credentials:
GET /api/v1/containers/credentials - Push Docker Image: Use Docker CLI to push to ECR
- Create Container:
POST /api/v1/containerswith ECR image URI - Poll for Status:
GET /api/v1/containers/:idevery 10 seconds - Access Your App: Once status is
running, use the provided URL
Container logs are retained for 7 days. For production workloads, consider setting up external log aggregation.