Skip to Content

Containers

Stable

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:

  1. Build and push your Docker image to ECR
  2. Get ECR credentials from /api/v1/containers/credentials

Get ECR Credentials

GET/api/v1/containers/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/api/v1/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

POST/api/v1/containers

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

ParameterTypeRequiredDescription
namestringDisplay name (max 100 chars)
project_namestringProject identifier (max 50 chars, used in URL)
ecr_image_uristringFull ECR image URI with tag
portintegerContainer port. Default: 3000
cpuintegerCPU units (256-2048). Default: 1792
memoryintegerMemory in MB (256-2048). Default: 1792
desired_countintegerNumber of instances (1-10). Default: 1
architecturestringarm64 or x86_64. Default: arm64
health_check_pathstringHealth check endpoint. Default: /health
environment_varsobjectEnvironment 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/api/v1/containers/{id}

Get container details and deployment status.

Container Status Values

StatusDescription
pendingDeployment initiated
buildingProvisioning EC2 instance
deployingCloudFormation stack creating
runningContainer is healthy and accessible
failedDeployment failed (check error message)
stoppedContainer manually stopped

Delete Container

DELETE/api/v1/containers/{id}

Stop and delete a container. This terminates the EC2 instance and deletes the CloudFormation stack.


Container Logs

GET/api/v1/containers/{id}/logs

Get container logs from CloudWatch.

Query Parameters

ParameterTypeDescription
tailintegerNumber of lines (default: 100)
sincestringStart time (ISO 8601)

Response

{ "logs": [ { "timestamp": "2024-01-15T10:30:00Z", "message": "Server started on port 3000" } ] }

Stream Logs

GET/api/v1/containers/{id}/logs/stream

Stream logs in real-time using Server-Sent Events.


Container Metrics

GET/api/v1/containers/{id}/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/api/v1/containers/{id}/health

Get container health status.

Response

{ "status": "healthy", "checks": { "http": "passing", "memory": "passing", "disk": "passing" } }

Deployment Workflow

  1. Get ECR Credentials: GET /api/v1/containers/credentials
  2. Push Docker Image: Use Docker CLI to push to ECR
  3. Create Container: POST /api/v1/containers with ECR image URI
  4. Poll for Status: GET /api/v1/containers/:id every 10 seconds
  5. 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.