Live data from Hacker News

Cloudflare Sandbox SDK

sandbox.cloudflare.com

21–30 of 95 posts

Re: Cloudflare Sandbox SDK

#21
Cloudflare Containers (and therefore Sandbox) pricing is way too expensive. The pricing is a bit cumbersome to understand by being inconsistent with pricing of other Cloudflare products in terms of units and split between memory, cpu and disk instead of combined per instance. The worst is that it is given in these tiny fractions per second.

Memory: $0.0000025 per additional GiB-second vCPU: $0.000020 per additional vCPU-second Disk: $0.00000007 per additional GB-second

The smaller instance types have super low processing power by getting a fraction of a vCPU. But if you calculate the monthly cost then it comes to:

Memory: $6.48 per GB vCPU: $51.84 per vCPU (!!!) Disk: $0.18 per GB

These prices are more expensive than the already expensive prices of the big cloud providers. For example a t2d-standard-2 on GCP with 2 vCPUs and 8GB with 16GB storage would cost $63.28 per month while the standard-3 instance on CF would cost a whopping $51.84 + $103.68 + $2.90 = $158.42, about 2.5x the price.

Cloudflare Containers also don't have peristent storage and are by design intended to shut down if not used but I could then also go for a spot vm on GCP which would bring the price down to $9.27 which is less than 6% of the CF container cost and I get persistent storage plus a ton of other features on top.

What am I missing?

Re: Cloudflare Sandbox SDK

#22
post #15
post #14

Looks like there's one feature missing from this that I care about: I'd like more finely grained control over what outbound internet connections code running on the box can make. As far as I can tell it's all or nothing right now: this.ctx.container.start({ enableInternet: false, }); I want to run untrusted code (from users or LLMs) in these containers, and I'd like to avoid someone malicious using my container to la…

This simple feature bumps up the complexity of such a firewall by several orders of magnitude, which is why no similar runtime (like Deno) offers it. Networking as a whole can easily be controlled by the OS or any intermediate layer. For controlling access to specific sites you need to either filter it at the DNS level, which can be trivially bypassed, or bake something into the application binary itself. But if you…

The most convincing implementation I've seen of this so far is to lock down access to just a single IP address, then run an HTTP proxy server at that IP address which can control what sites can be proxied to.

Then inject HTTP_PROXY and HTTPS_PROXY environment variables so tools running in the sandbox know what to use.

Re: Cloudflare Sandbox SDK

#23
post #9
post #7

Looks nice. We rolled out our own that does pretty much the same thing but perhaps more because our solution can also mount persistent storage that can be carried between multiple runners. It does take 1-5 seconds to boot the environment (firecracker vms). If this sandbox is faster I will instruct the team to consider for fast starup. This is also very similar to Vercel's sandbox thing. The same technology? What I do…

I browsed through the documents but it does not seem to be possible to auto destroy a sandbox after certain amount of idle time. This forces who ever is implementing this to do their own cleanup. It is kind of missed opportunity if you ask me as this is a big pain. It is sold as fire and forget but it seems that more serious workflows will require also a lot of supporting infrastructure.

You can easily set an alarm in the durable object to check if it should be killed and then call destroy yourself. Just a couple lines of code.

Re: Cloudflare Sandbox SDK

#24
post #21

Cloudflare Containers (and therefore Sandbox) pricing is way too expensive. The pricing is a bit cumbersome to understand by being inconsistent with pricing of other Cloudflare products in terms of units and split between memory, cpu and disk instead of combined per instance. The worst is that it is given in these tiny fractions per second. Memory: $0.0000025 per additional GiB-second vCPU: $0.000020 per additional v…

Startups would build on big tech, so are likely to add their margins. Have you looked into (bulk) discounts from GCP/AWS?

Re: Cloudflare Sandbox SDK

#26
post #9

Earlier quoted context omitted.

I browsed through the documents but it does not seem to be possible to auto destroy a sandbox after certain amount of idle time. This forces who ever is implementing this to do their own cleanup. It is kind of missed opportunity if you ask me as this is a big pain. It is sold as fire and forget but it seems that more serious workflows will require also a lot of supporting infrastructure.

You can easily set an alarm in the durable object to check if it should be killed and then call destroy yourself. Just a couple lines of code.

Nice. Thanks for the tip. I did not know that this was a thing. I will look it up.

Re: Cloudflare Sandbox SDK

#27
This looks interesting.

Instead of having to code this up using typescript, is there an MCP server or API endpoint I can use?

Basically, I want to connect an MCP server to an agent, tell it it can run typescript code in order to solve a problem or verify something.

Re: Cloudflare Sandbox SDK

#29
post #14

Looks like there's one feature missing from this that I care about: I'd like more finely grained control over what outbound internet connections code running on the box can make. As far as I can tell it's all or nothing right now: this.ctx.container.start({ enableInternet: false, }); I want to run untrusted code (from users or LLMs) in these containers, and I'd like to avoid someone malicious using my container to la…

Cloudflare has Outbound Workers for exactly this use-case: https://developers.cloudflare.com/cloudflare-for-platforms/w...

If these aren't enabled for containers / sandboxes yet, I bet they will be soon

Re: Cloudflare Sandbox SDK

#30

There is an open question about how file persistence works. The docs claim they persist the filesystem even when they move the container to an idle state but its unclear exactly what that means - https://github.com/cloudflare/sandbox-sdk/issues/102

To me, the docs answer it pretty clearly. The defined directories persist until you destroy().

The part that's unclear to me is how billing works for a sandbox's disk that's asleep, because container disks are ephemeral and don't survive sleep[2] but the sandbox pricing points you to containers which says "Charges stop after the container instance goes to sleep".

https://developers.cloudflare.com/sandbox/concepts/sandboxes...

https://developers.cloudflare.com/sandbox/concepts/sandboxes...

[2] https://developers.cloudflare.com/containers/faq/#is-disk-pe...

Post reply on HN