Reputation: 31652
If this is invalid CloudFormation templating then someone should tell the engineer that wrote this blog post: Managing Lambda@Edge and CloudFront deployments by using a CI/CD pipeline | Networking & Content Delivery
I'm using that template to deploy successfully.
But I want to use change sets to have safer deploys.
When I try to create a change set CloudFormation tells me CodeUri is missing:
Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [LambdaEdgeFunctionSample] is invalid. Either 'InlineCode' or 'CodeUri' must be set
This template deploys without issue.
Also I don't think I can use the sam commands for this (A simpler deployment experience with AWS SAM CLI | AWS Compute Blog) because the lambda function is only a small part of this CloudFormation template.
When trying a different CodeURI I can see it demands an s3 URL:
Transform AWS::Serverless-2016-10-31 failed with: Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [MyFunction] is invalid. 'CodeUri' is not a valid S3 Uri of the form \"s3://bucket/key\" with optional versionId query parameter.
Upvotes: 1
Views: 2653
Reputation: 886
For the template in the first article, If you remove the line 'CodeUri:' the template should deploy successfully. It seems to be complaining cause the line is empty.
If you are looking for a simple template to kick off a sam project, take a look at this one https://github.com/healthbridgeltd/nodejs-sam-bootstrap
It has a make file with multiple targets that makes your life easier.
Upvotes: 0