Skip to main content
Amazon Elastic File System (EFS) provides shared, persistent storage for your ECS containers. Use it when your agents need data to survive container restarts or deployments.

When to Use EFS

Agents like Pal use DuckDB to store structured data locally. Without EFS, this data is lost when containers restart.
Each ag infra up creates new containers. EFS ensures your data persists across deployments.
If you scale to multiple ECS tasks, EFS provides a shared filesystem all containers can access.

Pal Agent Requirements

Pal agent requires EFS in production. Without EFS, Pal’s DuckDB data (notes, bookmarks, research) is lost when containers restart or redeploy.

DuckDB Single Worker Requirement

DuckDB requires single-writer access. If using Pal or any DuckDB-based agent, set --workers 1 in the uvicorn command. The template defaults to --workers 2.
Multiple workers cause “database is locked” errors and potential data corruption.

Data Persistence Summary

Architecture

Setup Guide

1

Create an EFS File System

Create a new file system in your AWS region:
Save the FileSystemId from the response (e.g., fs-0123456789abcdef0).
Use generalPurpose performance mode for most workloads. Only use maxIO for highly parallelized applications.
2

Create an Access Point

Access points provide application-specific entry points with user/permission mapping:
Save the AccessPointId from the response (e.g., fsap-0123456789abcdef0).
The UID/GID 61000 matches the non-root user in the AgentOS container. This ensures your application can read and write to EFS.
3

Configure Infrastructure Settings

Update infra/settings.py with your EFS IDs:
infra/settings.py
4

Create Mount Targets

EFS needs mount targets in each subnet your ECS tasks use. First, deploy to create the EFS security group:
Then get the security group ID:
Create mount targets in each subnet:
5

Verify and Redeploy

Redeploy to pick up the EFS configuration:
Verify the mount by checking your container logs:
You should see your application start without errors. Data written to /data now persists across restarts.

Settings Reference

How It Works

When you configure EFS settings, the infrastructure automatically:
  1. Creates a security group (*-efs-sg) allowing NFS traffic (port 2049) from your app containers
  2. Configures an ECS volume with transit encryption enabled
  3. Mounts the volume at /data in your container
The relevant code in prd_resources.py:

Cost

EFS pricing is based on storage used: Example costs:
  • 1 GB of agent data: ~$0.30/month
  • 10 GB of documents: ~$3.00/month
There’s no minimum fee. You only pay for what you use.
Enable lifecycle policies to automatically move infrequently accessed files to cheaper storage classes.

Troubleshooting

Ensure you’ve created mount targets in the same subnets specified in infra/settings.py. Each subnet needs its own mount target.
Check that your access point uses UID/GID 61000 to match the container user. Verify with:
Check that the EFS security group allows inbound NFS (port 2049) from your app security group:
Ensure your application writes to /data, not another directory. Verify the EFS volume is mounted at /data in your container configuration.