Live data from Hacker News

AWS Lambda and .zip is a recipe for serverless success

medium.com

111–117 of 117 posts

Re: AWS Lambda and .zip is a recipe for serverless success

#111

Earlier quoted context omitted.

If anything — 50 LoC seems like it might even be an overestimate. I use a wrapper function around all my lambdas that deals with translating from the aws http headers to an application standard, asynchronously retrieves a config object, and converts promise based business logic to the aws callback format. The actual business logic is then written almost entirely in terms of the business domain. The wrapper is less th…

Is your wrapper code open source? If so, mind sharing a link? EDIT: I'm actually less curious about the code, and more curious about how you're sharing code between different Lambda functions. Did you publish an npm package? Are you just repeating the code? Symlinks?

The wrapper isn’t open source. The project is node (typescript) and uses serverless [serverless.com] for packaging and deployment.

Serverless allows deploying multiple lambdas with entry points exposed from an npm package using cloud formation with standard code sharing practices applying — that is it’s easy to share code between entry points if all the entrypoints are defined in one serverless config file (one serverless config file corresponds to one cloud formation stack)...

It’s a bit more work to share code between stacks with serverless tho ... You either have to put shared code into a separate npm module and depend on that module everywhere you need the shared code (often incidental complexity for simple or unstable code!) or use symlink patterns that work with the grain of how the serverless bundling process works...

I actually created an issue suggesting a serverless feature to ease this a few months ago https://github.com/serverless/serverless/issues/4124. In that somewhat long feature request I describe the symlink pattern I’m using for easily sharing code and compilation contexts between stacks... I’m still using that pattern — it’s not terribly fun to explain to new developers on the project but it works well without a lot of gotchas so far ...

Re: AWS Lambda and .zip is a recipe for serverless success

#112

Deploying .zip files is one of my favorite features of Lambda, particularly when writing Go apps. Docker always felt wrong with Go to me. Why do I need a local VM, a Linux build service, an image registry and servers with container orchestration to deploy Go software? I understand how all this helps with "legacy" Rails or Java apps, but why can't I just throw a Go binary somewhere to run it? Lambda is exactly this. I…

It actually wouldn't be too hard to build a MacOS tool for building scratch Docker containers with a cross-compiled Go binary. The docker image format roughly just a tar file containing a manifest json file and a tar file containing the root filesystem. *

Sure Lambda is pretty simple (just upload a zip!) and is very similar to what Google AppEngine has been doing since 2008 (AppEngine also uses zip). But you are signing up for complete lock-in...

Also, it's depressing to note that MacOS is now the only major operating system that does not have support for native Linux containers without the use of a VM. * *

* https://github.com/moby/moby/blob/master/image/spec/v1.md

* * https://www.hanselman.com/blog/DockerAndLinuxContainersOnWin...

Re: AWS Lambda and .zip is a recipe for serverless success

#113

Earlier quoted context omitted.

Why functions over Docker or Elastic Beanstalk? There's more than one PaaS path. On vendor lock-in, I'm moving between clouds now. Serverless did not translate well at all. We would have saved a ton of time, and frankly had an easier operational experience, if we went with Docker from be beginning. "Ok Jill, next we need to determine how Azure Storage Account bucket calls differ from AWS S3. Oh, S3 doesn't have queue…

Wait does Azure Storage finally have events? Personal project of mine I moved from Azure to AWS simply because Azure Storage didn't have events...

Yeah, Azure Storage Accounts have events now.

https://azure.microsoft.com/en-us/blog/announcing-azure-blob...

Re: AWS Lambda and .zip is a recipe for serverless success

#114

I use containers (Docker for Windows|Mac) to create my lambda zip for dist, isn't that close enough? lol.

I actually do the same thing. Do the dependency install inside of a docker container in order to build the .zip. This is absolutely essential for compiled libraries in python or anything that involves postgresql. If you attempt to install psycopg on mac and then deploy that on lambda it will fail. So you either need a prebuilt version for ubuntu that you keep around, or you need to build in a docker container. We jus…

Yeah, it works really well, also allows me to configure CI/CD in VSTS/TFS via Windows agents for AWS deploys to Lambda. In the end, I'm pretty pleased with it. I've mostly used Node, but Python binary dependencies would have the same need.

Not entirely sure why I got the downvote, other than the tongue in cheek aspect and "lol" at the end.

Re: AWS Lambda and .zip is a recipe for serverless success

#115
post #67

Earlier quoted context omitted.

Why would I split, write, and deploy an vendor cloud function for every cloud provider when Docker moves between them? My team ditched serverless functions. We're better off without them.

Wouldn't it be ideal if Docker (and other independent platform vendors) added function support? In my mind "cloud functions" are easily implemented on top of containers. Then we would get the best of both worlds.

The Azure Functions (Azure's equivalent to AWS Lambda) Host is open source: https://github.com/Azure/azure-functions-host/

There's probably enough there to bootstrap a container version.

Re: AWS Lambda and .zip is a recipe for serverless success

#116
post #107

Earlier quoted context omitted.

You don't need all of that shit, though. You absolutely can just throw a golang binary into a super minimal alpine image and run it wherever you've got a Docker daemon installed. You literally don't need any of the things you listed! Plus, it is simply untrue that "everything else is taken care of" in Lambda. There is plenty of one-off configuration to do ("toil").

If you're just working with a golang binary, you shouldn't be using an Alpine container, you should be putting the binary in an empty, from-scratch container. Go binaries are typically static and don't need distro or the libs it provides in their container.

Sure, I'm just saying that none of that stuff he says is necessary is needed at all.

Re: AWS Lambda and .zip is a recipe for serverless success

#117

Earlier quoted context omitted.

Wait does Azure Storage finally have events? Personal project of mine I moved from Azure to AWS simply because Azure Storage didn't have events...

Yeah, Azure Storage Accounts have events now. https://azure.microsoft.com/en-us/blog/announcing-azure-blob...

Thanks!
Post reply on HN