Deploy on AWS
Deploy an AgenticML server in your own AWS account with a single CloudFormation template. The stack creates an HTTPS load balancer, a single Graviton EC2 instance with SQLite on an encrypted data volume, and Amazon Cognito for sign-up and sign-in.
What you get
Section titled “What you get”browsers and ──HTTPS :443──▶ Application Load Balancer ──HTTP :8080──▶ EC2 instance (t4g.small)training machines (ACM certificate) agenticml server serve SQLite on encrypted EBS volume Amazon Cognito (sign-up / sign-in) ◀─────────────────────┘The template creates:
- One Graviton EC2 instance (default
t4g.small) in an Auto Scaling group of 1, runningagenticml-lite[oidc]from PyPI. - An encrypted gp3 EBS data volume for SQLite database storage and run files, with daily snapshots.
- An Application Load Balancer (ALB) terminating HTTPS with an AWS Certificate Manager (ACM) certificate.
- An Amazon Cognito user pool and public app client managing sign-up, email verification, and sign-in.
- An optional VPC with two public subnets in two availability zones, or deployment into an existing VPC.
- Instance access via AWS Systems Manager Session Manager. Port 22 is closed and no SSH keys are configured.
What you need
Section titled “What you need”- An AWS account with permissions to create IAM roles, EC2 instances, load balancers, and Cognito resources (
CAPABILITY_IAM). - A domain name with a Route 53 hosted zone, or an existing ACM certificate ARN in the same AWS region.
- An administrator email address.
Running the server costs about $45–55 a month.
Estimated monthly breakdown:
- EC2 instance (
t4g.smallGraviton): ~$12–15 - Application Load Balancer: ~$16–22
- EBS gp3 data volume (50 GiB) and root volume: ~$4–6
- EBS snapshots (daily DLM retention): ~$1–3
- Public IPv4 addresses: ~$7–10
- Amazon Cognito: free up to 10,000 monthly active users on the Lite tier
This is an estimate, check the AWS pricing pages for current rates in your region.
Launch
Section titled “Launch”You can deploy using the AWS CLI or the AWS Management Console. A one-click Launch Stack link will come later.
Run it from a clone of the agenticml-lite repository, or save the template and change --template-file. When you pass CertificateArn, the ACM certificate must be in that region.
Run aws cloudformation deploy:
aws cloudformation deploy \ --stack-name agenticml \ --template-file deploy/aws-self-hosted/agenticml.yaml \ --region <region> \ --capabilities CAPABILITY_IAM \ --parameter-overrides DomainName=aml.example.com HostedZoneId=Z0123456789ABC AdminEmail=you@example.comConsole
Section titled “Console”- Download
agenticml.yamlfrom the latest GitHub release, or from the release for your version. - Open the AWS CloudFormation console.
- Select Create stack > With new resources (standard).
- Under Prerequisite - Prepare template, select Choose an existing template, choose Upload a template file, and select
agenticml.yaml. - Enter a stack name and fill in the required parameters.
- Under Capabilities, select the checkbox acknowledging IAM resource creation (
CAPABILITY_IAM). - Select Submit. Creation takes about 10 minutes.
If using an existing ACM certificate instead of a Route 53 hosted zone, add a CNAME record in your DNS provider pointing your domain to the AlbDnsName output.
Parameters
Section titled “Parameters”| Parameter | Default | Meaning |
|---|---|---|
DomainName |
required | Name people use to reach the server, for example aml.example.com. |
HostedZoneId |
empty | Route 53 zone: creates the certificate and DNS record. Give this or CertificateArn. |
CertificateArn |
empty | Issued ACM certificate in this region. Give this or HostedZoneId. |
AdminEmail |
required | Signing up with it makes you server administrator and owner of the default workspace. |
SignUp |
invite-only |
invite-only, or open (every verified email gets its own workspace). |
AllowedEmailDomains |
empty | Comma-separated domains, no spaces. Only these domains, and the AdminEmail, can sign up through Cognito, in both modes. The server additionally applies it to personal workspaces when SignUp=open. Domains match exactly (no subdomains). Invitees must be in these domains, because Cognito refuses other domains. Empty means no restriction. |
CognitoDomainPrefix |
empty | Cognito sign-in domain prefix; empty derives one from the stack ID. |
AgenticmlVersion |
3.3.1 |
Version installed from PyPI. |
InstanceType |
t4g.small |
Graviton instance type. |
DataVolumeSize |
50 |
Data volume in GiB (whole number from 10). A raised size applies to the volume at once and to the file system at the next instance restart or replacement. |
BackupRetentionDays |
14 |
Daily snapshots to keep. |
WorkspaceStorageGB |
20 |
Storage limit per workspace, in GB. Keep the total within DataVolumeSize. |
PeoplePerWorkspace |
50 |
Members plus pending invites per workspace. |
DataSnapshotId |
empty | Restore: ID of a snapshot of the old data volume, for a NEW stack only. |
Scheme |
internet-facing |
internal keeps the load balancer private. |
AllowedCidr |
0.0.0.0/0 |
IPv4 range allowed to reach the load balancer. |
VpcId |
empty | Empty creates a VPC. Otherwise also give PublicSubnetIds. |
PublicSubnetIds |
empty | Two or more subnets of the existing VPC, comma-separated, exactly one per zone. The instance and data volume use the first one; the server trusts the load balancer in these subnets. |
AssignPublicIp |
true |
The instance needs internet access (PyPI, Cognito). Must be true with the VPC this stack creates; false only with a NAT gateway or endpoints. |
First sign-in
Section titled “First sign-in”When stack creation finishes, open the Url output in a browser and choose Sign in:
- In invite-only mode (
SignUp=invite-only), the admin email becomes owner of thedefaultworkspace at first boot and signs up through the Cognito page. - In open mode (
SignUp=open), every verified email gets its own personal workspace. AllowedEmailDomains: only these domains, and theAdminEmail, can sign up through Cognito, in both modes. The server additionally applies it to personal workspaces whenSignUp=open. Domains match exactly (no subdomains). Invitees must be in these domains, because Cognito refuses other domains.- The Cognito app client lets users write
emailandname, and a new email must be verified before it takes effect.AllowedEmailDomainsgates sign-up only, so an admitted user could later switch to another verified email outside those domains.
Inviting people
Section titled “Inviting people”To invite team members:
- Open the dashboard and navigate to Settings > Members.
- Enter the person’s email address and assign a workspace role (
viewer,member, oradmin). - Copy the invite link (
/invite#token=...). - Send the link to the invitee. When they open it, they sign in or sign up through Cognito using that email.
Connecting training machines
Section titled “Connecting training machines”Install agenticml-lite on the training machine:
pip install agenticml-liteLog in using the server URL:
agenticml login --host https://aml.example.comEnter your API key at the prompt. Generate an API key from the dashboard under Settings > API keys. Never put an API key directly on the command line.
Synchronize training runs:
agenticml sync --followUpgrades
Section titled “Upgrades”To upgrade the server:
- Perform a CloudFormation stack update with a new
AgenticmlVersion. - The Auto Scaling rolling update replaces the instance with the new version.
- Upgrades cause a few minutes of downtime while the instance is replaced.
- Server data stays on the EBS volume and is attached to the new instance automatically.
Backups and restore
Section titled “Backups and restore”- Daily Amazon Data Lifecycle Manager (DLM) snapshots are created automatically and kept for
BackupRetentionDaysdays. Snapshots are crash-consistent (taken while the server runs). - To restore, create a new stack with
DataSnapshotIdset to the snapshot ID of the old data volume. People sign in again with the same email; the server relinks their accounts by verified email. Afterwards runagenticml server verifyover Session Manager:Terminal window sudo -u agenticml /opt/agenticml/bin/agenticml server verify --data /var/lib/agenticml-server - For a consistent copy at a chosen time, run
agenticml server backup --to DIRover Session Manager. The target must be empty or absent and outside the data directory; it sits on the instance’s root volume, which is replaced with the instance; so copy it off the instance (for example to S3) and check there is room. First create the directory:Then run the backup:Terminal window sudo install -d -o agenticml -g agenticml -m 0700 /var/lib/agenticml-backupTerminal window sudo -u agenticml /opt/agenticml/bin/agenticml server backup --to /var/lib/agenticml-backup --data /var/lib/agenticml-server
Growing the disk
Section titled “Growing the disk”To expand disk capacity, increase DataVolumeSize in a stack update. CloudFormation expands the EBS volume immediately. The XFS file system grows automatically at the next instance restart or replacement. An EBS volume cannot be shrunk.
Private-only (Scheme=internal)
Section titled “Private-only (Scheme=internal)”To run the server on an internal network without public exposure, set Scheme=internal and configure AllowedCidr to your private network range. Deploy into an existing VPC with VpcId and PublicSubnetIds. Scheme=internal still needs the instance to reach PyPI and Cognito (public endpoints, NAT or VPC endpoints), and Cognito’s sign-in page is on a public hosted domain, so this is not an air-gapped setup. See Private networks for proxy and client network requirements.
Operating it
Section titled “Operating it”Connect to the instance using AWS Systems Manager Session Manager (SSH is disabled and port 22 is closed):
aws ssm start-session --region <region> --target <instance-id>You can copy the exact command from the SessionManagerCommand stack output.
Operational files on the instance:
- Bootstrap log:
/var/log/agenticml-bootstrap.log - Service journal:
sudo journalctl -u agenticml-server - Environment configuration:
sudo cat /etc/agenticml-server.env
Deleting the stack
Section titled “Deleting the stack”When you delete the CloudFormation stack:
- The EBS data volume creates a final snapshot before deletion (
DeletionPolicy: Snapshot), and daily DLM snapshots remain. - The Cognito user pool is retained (
DeletionPolicy: Retain) and has deletion protection set toACTIVE; the pool’s domain and app client are deleted with the stack.
To delete them permanently by hand:
- Open the Amazon EC2 console, navigate to Snapshots, and delete the final and daily snapshots.
- Open the Amazon Cognito console, select the user pool, turn off deletion protection in pool settings, and delete the user pool.
Limits and caveats
Section titled “Limits and caveats”- Never change the first subnet or its zone: The data volume resides in the availability zone of the first subnet listed in
PublicSubnetIds. Changing the first subnet or its zone causes CloudFormation to replace the data volume with an empty volume. When using an existing VPC,PublicSubnetIdsmust list exactly one subnet per availability zone, across at least two zones. - Cognito email limits: Cognito’s default email sender is limited to 50 verification and password reset emails per day. Configure Amazon SES in the Cognito user pool for production workloads.
- Customer-managed EBS KMS keys: The volumes are encrypted with the account’s default EBS key. The instance role has no KMS permissions, which is enough for the AWS-managed
aws/ebskey. If your account default is a customer-managed KMS key, grant the instance role and the Auto Scaling service-linked role use of that key, or switch the default toaws/ebs. - PyPI version: The version set in
AgenticmlVersionmust be published on PyPI.