在 CloudFront 的 edge 上跑 Lambda

所以 Amazon CloudFront 讓使用者在 edge 上跑程式了 (雖然目前是 limited preview):「Lambda@Edge – Preview」。

分成 Viewer Request、Origin Request、Origin Response 以及 Viewer Response 四個階段可以插入修改。另外有些限制:

Because your JavaScript code will be part of the request/response path, it must be lean, mean, and self-contained. It cannot make calls to other web services and it cannot access other AWS resources. It must run within 128 MB of memory, and complete within 50 ms.

要在 128MB 內搞定,而且不能呼叫其他資源。不過這樣已經可以做很多事了... 基本上就是一台 turing machine 了 :o

This entry was posted in AWS, CDN, Cloud, Computer, Murmuring, Network, Programming, WWW and tagged , , , , , , , , , , . Bookmark the permalink.

2 Responses to 在 CloudFront 的 edge 上跑 Lambda

  1. Pingback: Cloudflare 也能在各端點跑 JavaScript 了 | Gea-Suan Lin's BLOG

  2. frank liu says:

    目前还在测试,貌似 128M内存,1M压缩包 除了修改下资源 重定向,也干不了什么,比如图片压缩

Leave a Reply

Your email address will not be published. Required fields are marked *