Need an optimized sandbox setup for coding agents

I have some aws credits and planning to use it to run coding agents.

I’m comparing my setup standard ec2 setup against sandbox providers like E2B and Daytona who use aws on the backend but they have teams that optimize their setup very well so its far cheaper and better at performance.

I’m trying to understand how much of that I could replicate on AWS myself.

My main usecases would be:
- Run multiple coding agents concurrently, each with its own isolated filesystem and environment.
- Internet access for fetching dependencies, accessing GitHub, and making API calls.
- Fast startup times and minimal idle resource usage


Related discussions:

Anyone else getting a 500 for EC2 Console right now?
Load testing my EC2 c3.4xlarge, Maxing At 1000Mbps
The same ec2 instance is being created upon termination.
Learning AWS CLI: How can I get a list of instance ID's?
EC2's most dangerous feature
Nano Server on AWS: Step by Step
re:Invent Live Stream Registration
EC2 Price Reduction (C4, M4, and T2 Instances)
Introducing the AWS Serverless Application Model
How Do You Choose Between EC2 and Lambda?
How Do You Monitor Your AWS Resources
Why IAM Misconfigurations Cause Most AWS Security Issues
AWS Elastic IP vs Static IP on VPS
shadow manager get event when changed
Setting up sending/receiving emails with EC2.
ec2dns, a tool to work with ssh and ec2, written in PHP with the AWS SDK. [Cross-post from /r/php]
Various Amazon AWS services down since 10PM BRT -South America AZ
Why an EC2 Instance is Not a Server
EC2 Update - Virtual Private Clouds for Everyone
Continuous Windows AMI Builds
Trying to decide whether we should bake or bootstrap
Video about the founding office of EC2 in Cape Town, South Africa
how many of you back up windows instances in ec2 with snapshots? How are you automating it?
Amazon Linux Support Systemd?
How do you recruit AWS-savvy workers?
What's the thinking behind BeanStalk's versioning system limits?
ec2dns 2.0, a tool to resolve EC2 instance name tags via DNS. Powered by the AWS SDK.
How do you name your instances?
Question about Auto Scaling Groups and Launch Configurations
Is SES ideal to relay emails from our EC2 web app to our private SMTP server?
Security Group source equals itself.
How to Help Lock Down a User’s Amazon EC2 Capabilities to a Single VPC
Elastic Transcoder Pricing
Migrating from MS AD to AWS Simple Directory Services
AWS Beginner questions
AWS Backup Solution
AWS automation
Clueless agencies on EC2...
Has anyone attended an AWS "Zombie Apocalypse" workshop in their city?
Newb Question - Considering hiring new programmer to fix my site, and he's new to AWS. How can he download all of the code for my site?
EC2 Small vs EC2 Micro + Micro RDS
Can't ssh from one (public) ec2 instance to another (private) one
Please explain a typical day for an AWS professional.
Does using a ProxyPass on a ec2 instance toward S3 bucket can cause a problem?
Using Custom AMI as a template?
Can I use AWS EC2 with my AWS Educate account?
Strange sleep/hibernation mode for Windows Server on EC2?
Migrate a Virtualbox vm to EC2
How Cloudsploit made the whole company “serverless”
AWS free tier clarification
Easiest Way to Update Launch Configurations
AWS Region fees/Dedicated Hosts for HIPAA going away?
Using AWS to setup a very simple VPS to use as a tunnel proxy?
Auto assign EIP
New: 'Target tracking scaling' for EC2 auto-scaling?
New AWS G3 GPU Compute Instances launched in EC2
AWS Resource Tagging free?
Why is the default instance type in AWS EMR still m3.xlarge?
Domain Controllers in AWS
Question about cost's associated with multiple EC2 Instances
AWS announces per-second billing for EC2 instances
User data shell scripts vs cloud-init?
Adobe After Effects rendering on a EC2 g3.16xlarge
What happens when an EC2 host fails?
Guide: Restore AWS EC2 instance private key
A question about auto Scaling policies
[Question] Advantages of NAT vs Public
Hosting a game on AWS
Using AWS to Host Domain Controller(s) and Active Directory
JSON assistance
Is there anyway to encrypt data moving from EFS to EC2?
Make EC2 instance only accessible through static website hosted on S3.
Which AWS product for a minecraft server that scale dynamically?
Trying to get a website running on an ec2 instance
What business problem does serverless computing solve?
What's the "best" serverless way to send messages/data (in order) to both mobile and web clients for users simultaneously? I'm envisioning some sort of client app (web and mobile (iOS and Android)) that pulls for this data and does something with it.
Running Program from Task Scheduler on EC2 Instance?
Reserved instances - are they pinned to an instance or can you 'float' them
health checks can be blocked via SG
Question about AccessKeyId & SecretAccessKey in metadata on EC2
Odd Request - Hoping someone can help!
ec2details, the missing EC2 Instance Metadata API
SQL error in front-end and back-end.
Can't use Jupyter notebooks on AWS no matter what I try
Quickest way to find EC2 instances associated with security groups?
Restoring manually changed Cloudformation resources
TIL of the TerminateInstanceInAutoScalingGroup API
I Imported a Windows EC2 with BYOL. Can I convert this to an AWS managed license instance?
What Is Serverless Computing?
Question about KMS (2018-05)
Would like to run Python scripts once every 50mins (Take around 2mins to run), best way to setup?
Easiest way to create EC2 instance and storage billing report with instance and storage volume "name" included?
li - A small tool to quickly find information on EC2 instances
Enable AWS Elastic Container Registry custom domain and anonymous access over private network - Medium
EC2 is running but stops responding after few hours
[N] Amazon Linux 2 is in General Availability
2018 Serverless Community Survey: huge growth in serverless usage
AWS reinvent what will be released. Any speculations
Convert EC2 Nginx using RDS to Beanstalk
Newbie question - can't run existing EC2 instance using existing subnet ID
Has anyone used AWS EC2 Instances to study for Microsoft Certs?
How do I limit the creation of EC2 instance
EC2 Instances with 6, 9, and 12 TB of Memory - Perfect for SAP HAHA
Any rootkit detectors or incident response tools that can scan EBS snapshots of an EC2 CenttOS OS disk?
How does the Amazon Web Services (AWS) Charges/Bills?
Introducing Firecracker, a New Virtualization Technology and Open Source Project for Running Multi-tenant Container Workloads
Questions about auto scaling alarms
Does lets encrypt work in AWS ec2?
Recommendations for how to achieve something on AWS
Anyone using API Gateway Websocket APIs?
g2 instance pricing?
Ultra-noob question: My EC2 instance cannot ping a particular public IP that I can ping from everywhere else?
What's the point of the "Keep this group at its initial size" option for Auto-Scaling?
Cloud Custodian - What's your setup?
AWS Products & working explained in Simple English. Thank God.
Lock down EC2, to the office colleagues
Is it possible that Amazon itself rebooted my EC2 instance?
What's the difference between Throughput & IOPS per Volume vs Instance?
Disappearing AZ
Which EC2 is appropriate for development?
How to do development on ubuntu ec2
S3 Benchmark
Am I doing something wrong? Why is RDS so expensive?
Auto-Backup EC2 Instance?
Questions about dynamically standing up many ec2 instances with secure connections
AppStream 2.0 at scale
CloudBanshee: a mobile-friendly EC2 comparison tool
Anyone else having issues with S3 in us-west-2 this morning?
Don’t Be Surprised by Your Serverless Bill
I ran some benchmarks on r5d's today using their NVME SSD's as pure swap space. Turns out they work phenomenally well!
New sizes for m5, m5d, m5a, r5, r5d, and r5a instances
Introducing EC2 Instance Connect (IAM-integrated native SSH)
What is the meaning of "limit per account per..."?
Am I charged for stopped reserved instances?
Can’t reach RDS from EC2
clean up associated resources on instance termination with boto3
New Amazingly Cheap AMD Instances in Mumbai (t3a, m5a, m5ad, r5a, r5ad)
AWS Compute Optimizer – Your Customized Resource Optimization Service
📦 This project was design to allow anyone to drop a digital packaged in front of your digital front porch - all serverless.
Hosting a small JIRA instance on AWS: A case study
Does this diagram make sense? (2020)
AWS Noob - Connected a PLC (IoT Device) to AWS as a "thing", how do I go about building a simple app to collect the data?
New AWS OS for running containers
NLB --> EC2 possible?
OS storage type for t3a.nano
Coordinating resource creation and modification in a small team
Can somebody tell me if they think using Amplify is the right choice for my personal / hobby project? I keep getting frustrated with things "breaking" with deployments and I'm wondering if I should go back to something like serverless + using AWS ser
AWS equivalent service to Google Maps API Distance Matrix
Find Your Most Expensive Lines of Code – Amazon CodeGuru Is Now Generally Available
How to Enforce Tagging?
EC2 Spot Instances
Amazon Braket – Go Hands-On with Quantum Computing
Speculation About Graviton 3
Dead Man Switch project needs devs
Unable to run mongoexport on EC2 Linux
Witness someone brute forcing my EC2 instance. I have 0 users so I'm not concerned, however how can I learn from this? Or better how do I prevent a brute force attempt?
Ec2Instances.info website was bought by Vantage
Elastic IP pricing clarifications and recommendations
No enough examples for CDK
EC2 X2gd Instances – Graviton2 Power for Memory-Intensive Workloads
Is there an existing dashboard page to show what regions have active EC2 instances?
AWS App Runner – Fully managed container application service - Amazon Web Services
I have roughly 300 aws accounts I need to update lifecycle policy rules for, what's are some options?
EC2 instances in cluster to send all outbound traffic via a single IP?
Database Automation Question
What’s the point of deploying VMWare to your cloud if there is already EC2 and you can accomplish the same without VMWare?
Vertical Scaling of EC2 server for infrequent, large jobs
New – Amazon EC2 M6i Instances Powered by the Latest-Generation Intel Xeon Scalable Processors | Amazon Web Services
AWS to game?
Amazon EC2 now offers Global View on the console to view all resources across regions together (2021-09)
EC2 IIS hosted web app says Insecure?
Gaining approval for 1 g4dn.xlarge EC2 instance (ondemand or spot) for new account?
Best way to automate AWS AMIs creation and have it auto delete old AMIs (for example 6 months old)
S3 across two different EC2
One route Flask App: EC2 or another option?
Connect multi-region ec2 instances with lowest latency
Info on being fedramp low in aws
charged for on-demand with reserve instance?
Introducing Seekable OCI for lazy loading container images
AWS Shutdown EC2 on budget alert
AWS IAM Role should be assumed only by specific EC2 Instances
What questions I should be asking during hand-over of AWS env.?
t2.nano or t3.nano in my case?
Optimize Data Transfer Out Cost?
Achieving idempotency in the AWS serverless space
Any guidance, advice or tips you have following an upgrade of EBS volume in production?
ECS capacity provider starts EC2 instance, but no container instances available
Why can I never get AWS tutorials to work? Am I just stupid? (rant)
Configuring ssh traffic
Can we run AWS CLI to generate reports for all regions?
Still using EC2 jump host for SSH into private subnets?
EC2 naming explained
EC2 behind NAT can’t reach internet without a public IP
AWS Cloud9 to run Headless Chrome with Selenium on AWS EC2 and Lambda
How do I grant ecr:DescribeRepositories permissions to an external AWS account
How many attached GPUS on a Snowball Edge with GPU?
AWS service for transcoding audio to mp3 and images to jpg?
Student accounts ?
Spot users, how often are your instances interrupted? Any tips on how to avoid this?
Can't connect with SSH to EC2 instance after reboot
account hacked and hundreds of services added, what should I do?
Why is this API Gateway Authorizer causing me so much trouble?
Help Understanding Setup Concepts.
Huge amount of AMIs
i get this error after some days of creating the ec2
How does AWS handle DMCA notices? We got an abusive/irrelevant DMCA notice
Migration of 25 static websites to AWS
EC2 CPU Usage surges
AWS DescribeInstanceStatus permission for a specific Instance
How to develop against API Gateway WebSocket APIs?
ec2instances.info requests for feedback
EC2: HTTP requests failing to public IP address/assigned DNS, but works fine when using my own domain
Finally! Auto-deletion of snapshots associated with AMIs during AMI de-registration!
How to get rid of orphan snapshots?
How do I sell an AWS EC2 Reserved Instance in India
I hate the current EC2 instance type explorer page
What's the future of Amazon Linux?
Patch Windows
AWS introduces Graviton5—the company’s most powerful and efficient CPU
PSA: If you're heavily using ECS with EC2, check that your capacity provider hasn't given you ghost instances that aren't actually running tasks
Amazon EC2 supports nested virtualization on virtual Amazon EC2 instances
Running Oracle database on EC2 for free?
Lost an important IP because it wasn't elastic
AWS EC2/S3 alternative in or near Tokyo?
AWS App Mesh
I was today years old when I learned about EC2 Image Builder
Reserved RDS in Japan slightly more expensive than on-demand?
AWS Beginner looking to host a headless server
Deploy code to Autoscaling EC2
Question about migrating my PHP API to AWS
EC2 micro just stops randomly for ~5minutes
US-EAST-1 experiencing increased error rates. (again!)

firecracker like pint said is the right base, the trick the sandbox companies use is snapshots. boot one vm with your dependencies installed, snapshot it, and every agent starts from that in under a second instead of a cold boot

for idle, pause the vm to disk when the agent goes quiet and wake it on the next request. that’s most of the gap vs plain ec2. on aws you need metal instances or ones with nested virtualization for it

i built groundbox sandboxes this way if you want something to compare your setup against https://groundbox.dev/docs/sandboxes

Pausing a Firecracker microVM leaves its EC2 host running. AWS still charges for a running On-Demand instance, even when it is idle. If you keep one host running all day for a few intermittent agents, guest snapshots won’t remove that idle host bill.

For your comparison, count total host-hours per completed agent job at the concurrency you expect, including gaps between jobs. Packing guests onto fewer hosts can improve that number. To stop instance-usage charges during long idle periods, you need to stop or terminate empty hosts and preserve the guests’ saved state somewhere durable. Stopping an EBS-backed host still leaves its EBS storage charges.