Why doesn't cloudformation support ZipFile for golang lambdas?
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?
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).
Relevant questions
Resource handler returned message: "AMI cannot be described (Service: AutoScaling, Status Code: 400)
asked 2 months agoAWS Cloudformation
asked 23 days agoCloudFormation stack stuck in UPDATE_COMPLETE_CLEANUP_IN_PROGRESS
Accepted Answerasked 7 months agoCode Style guide for AWS Cloudformation and CDK
Accepted Answerasked 7 months agoWhy is there a long delay between CREATE_IN_PROGRESS event for a Lambda-backed CloudFormation custom resource and the Lambda function invocation?
Accepted Answerasked 7 months agoHow to troubleshoot Cloudformation "Invalid request provided: AWS::ElasticLoadBalancingV2::ListenerRule Validation exception"?
asked 4 months agoCloudformation support for creating configurations
asked 3 years agoWhy doesn't cloudformation support ZipFile for golang lambdas?
asked 12 days agoCan we get output from a Lambda function as CloudFormation Parameter?
asked 2 years agoWebsockets Golang Example
asked 3 years ago