# Difference between AWS Lambda and Fly Machines?

**URL:** <https://community.fly.io/t/difference-between-aws-lambda-and-fly-machines/9124>\
**Category:** Questions / Help\
**Created:** [December 1, 2022, 6:48pm UTC](https://community.fly.io/t/difference-between-aws-lambda-and-fly-machines/9124 "2022-12-01T18:48:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jessie](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/jessie/32/8723_2.png) [@jessie](https://community.fly.io/u/jessie)\
**Post date:** [December 1, 2022, 6:48pm UTC](https://community.fly.io/t/difference-between-aws-lambda-and-fly-machines/9124/1 "2022-12-01T18:48:05Z")

</div>

From the perspective of someone deciding between AWS Lambda and Fly Machines to run our customers’ untrusted code, what are some things to consider? What are some differences between the two? I’ve used Lambda extensively and functionality and cost wise they seem pretty similar.

How is the cold start compared to AWS Lambda, especially now that they’ve launched SnapStart, which should essentially get rid of cold starts (though it’s only available for Java at the moment)? Does Fly offer something similar? It seems to be the case, from reading the [Run User Code on Fly Machines · Fly Docs](https://fly.io/docs/machines/guides-examples/functions-with-machines/) section titled “Start an Existing Machine”.

---

<div class="post-metadata">

**Author:** ![ignoramous](https://avatars.discourse-cdn.com/v4/letter/i/a9adbd/32.png) [@ignoramous](https://community.fly.io/u/ignoramous)\
**Post date:** [December 1, 2022, 10:28pm UTC](https://community.fly.io/t/difference-between-aws-lambda-and-fly-machines/9124/2 "2022-12-01T22:28:59Z")

</div>

> [@jessie](#):
>
> How is the cold start compared to AWS Lambda

We haven’t like scientifically benchmarked this, but in random observations, we have found that our NodeJS Machines start in 10ms to 600ms, with 100ms-200ms being the norm.

> [@jessie](#):
>
> …especially now that they’ve launched SnapStart

That one is a game-changer. For AWS.

> [@jessie](#):
>
> Does Fly offer something similar?

Yes. Fly Machines are kind of _SnapStart_ing already since the code / image is kept on the _host_ ready-to-go (there’s no download code/image step on Fly). That said, [Fly plans to improve upon their existing cold-starts](https://community.fly.io/t/vm-snapshot-vs-volume-snapshot/5992/3) by restoring from VM snapshots (aka doing _SnapStart_ for real).

> [@jessie](#):
>
> Fly Machines to run our customers’ untrusted code, what are some things to consider?

Fly Machines are great for SaaS; the only caveat is multi-tenancy in a single Fly Machine app is a bit of a hairy proposition: [Machines not responding to Non Standard Ports - #23 by dfragnito](https://community.fly.io/t/machines-not-responding-to-non-standard-ports/6937/23)

> [@jessie](#):
>
> What are some differences between the two?

- The major one is, on Fly, you have to explicitly exit the _main_ process with exit code `0` or it keeps running.
- The other thing it is early days for Fly Machines, they’re [_in-preview_](https://community.fly.io/t/will-shared-multicore-cpus-come-to-regular-apps-not-just-machines/6271/2).
  - Things like `flyctl` support isn’t quite there yet (but there’s a [nifty REST API](https://community.fly.io/t/is-api-machines-dev-safe-to-use/8449) at least).
  - Also, [according to Fly docs](https://archive.is/hKNXK) (and [in my experience too](https://community.fly.io/t/preview-postgres-on-machines-fly-apps-v2/7483/2)), _Fly Proxy_ has trouble load-balancing when there are multiple VMs (of a single Machines app) running in the same region.

- I’ve also had to deal with [Zombie VMs](https://community.fly.io/t/a-zombie-machine-appears/8146), [Ghost VMs](https://community.fly.io/t/machines-error-blocking-deploys-no-responders-available-for-request/8954), and [Phantom VMs](https://community.fly.io/t/overriding-staged-secrets-for-machines/8493/7)… It is quite something! (: I am sure Lambda has its share of quirks, too.

---

<div class="post-metadata">

**Author:** ![Alex21](https://avatars.discourse-cdn.com/v4/letter/a/5e9695/32.png) [@Alex21](https://community.fly.io/u/Alex21)\
**Post date:** [March 14, 2023, 8:28pm UTC](https://community.fly.io/t/difference-between-aws-lambda-and-fly-machines/9124/3 "2023-03-14T20:28:33Z")

</div>

> [@ignoramous](#):
>
> We haven’t like scientifically benchmarked this, but in random observations, we have found that our NodeJS Machines start in 10ms to 600ms, with 100ms-200ms being the norm.

Is there an example for how to achieve a NodeJS start time of 10ms? In my testing, it takes [Fly.io](http://Fly.io) a minimum of 200ms (in addition to the ~200ms to start Firecracker) to execute `node server.js` even if all server.js contains is:

```auto
console.log("Node.js started")

```

Are there tricks for reducing that?
