By using AWS re:Post, you agree to the Terms of Use
/Why doesn't cloudformation support ZipFile for golang lambdas?/

Why doesn't cloudformation support ZipFile for golang lambdas?

0

It's really painful that CloudFormation won't let me declare a lambda as a ZipFile:

Resource handler returned message: "Invalid request provided: The ZipFile attribute is not supported for the runtime 'go1.x'"

Why should it care that the content of the .zip is go? It's just an executable.

The problem is there's no clean workaround. I was going down a path of uploading the .zip separately but the problem there is if the filename (s3 key) doesn't change then CloudFormation won't think it needs an update. I can generate a random file name (s3 key) every time but that has to be passed into using --parameter-overrides which also is a little messy. It's sort of compounded by the problem that the aws sdk for go has no support for packaging stacks directly from go.

I guess this is the way it is, but go definitely is a second class citizen here, so my main question is will it always be this way?

asked 12 days ago15 views
1 Answers
0

The ZipFile attribute in CloudFormation only works with scripted language runtimes nodejs and python, since CloudFormation does not / cannot do the "compile" step for you. The clean way is to use S3Key as you already stated corectly. And then specify new versions with S3ObjectVersion.

AWS SAM automates these steps for you. Another tool worth a look for compiling/handling Lambdas with CloudFormation is the CDK (golang alpha module).

answered 11 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions