Comments (11)
FunctionName
is here! - https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
from serverless-application-model.
We will support FunctionName in SAM shortly. I doubt we will try to do inline code. It just doesn't scale well.
from serverless-application-model.
No ETA yet. This functionality, if done wrong, breaks your ability to deploy copies of the same stack to same region. We should think through this feature.
Would it be acceptable if SAM automatically appended your stack name with the Lambda function name? This way you are less likely to have two Lambda functions in the same region with same name.
from serverless-application-model.
I don't think SAM should be altering the name in anyway.
You should leave it up to the developer to decide on the name in the same way you can with CF. If there are name collision issues they can be handled in the same way as CF with a Stack Generation error.
Ultimately the developer should be able to choose any format that makes it unique. SAM should not be handholding.
In my case I want something like the following but another group might want something entirely different:
Resources:
MySimpleFunction:
Type: AWS::Serverless::Function
Properties:
Function: !Sub 'my-simple-function-${stage}'
from serverless-application-model.
One potential use case for this feature: when you are using Lambda versioning and want to have a beta deploy and prod deploy in the same CodePipeline updating the same Lambda function. The CodePipeline flow goes something like this:
- Source: git master merge triggers pipeline
- CodeBuild: builds Lambda package zip, runs
aws cloudformation package
, and hands off output template andbeta
/prod
config files - CloudFormation: creates and executes
beta
changeset, which replaces the$LATEST
for the named function, publishes a version, and updates the aliasbeta
to point to that version - Manual Approval
- CloudFormation: created and executes
prod
changeset, which updates the aliasprod
to point to the version being pointed to bybeta
We could accomplish this by having two totally separate Lambda functions published in different stacks, but then we're not technically cutting over to the deployed function version that has been tested and approved.
from serverless-application-model.
Agreed. This is quite important.
from serverless-application-model.
@sanathkr Any ETA on this feature? Seems like it would be nice to at least have parity with CloudFormation.
from serverless-application-model.
Although in retrospect I suppose that configuration could work even with the auto-generated name, operating on a single stack. I'll give it a shot.
from serverless-application-model.
After testing, I think either of the approaches mentioned by @sanathkr or @gmetzker would be fine for this use case.
from serverless-application-model.
Apologies for the verbosity... Further experimentation led me to discover what @sanathkr described in #41: that new versions don't publish each time. Guess I'll have to find a workaround for this either way.
from serverless-application-model.
In the AWS cloudformation forums I just saw this post:
AWS Lambda: Use the <code class="code">FunctionName</code> property of AWS::Lambda::Function
resource to specify a name of your AWS Lambda function.
Also, you can use Python 2.7 to specify an inline function.
Does this mean we can use this in SAM as well? Or will this be supported shortly?
from serverless-application-model.
Related Issues (20)
- Bug: AWS SAM tag value on AWS::Serverless::Function empty when value is False HOT 4
- Feature Request: Add SQS Redrive option to SNS event HOT 3
- Set Visibility timeout of the SQS with reference to the timeout of the function HOT 1
- `AWS::Serverless::Api` creates stage named `Stage` instead of requested stage name HOT 6
- "Invalid OpenAPI input" when OpenAPI set to `3.1.0` HOT 4
- AWS SAM Connector Write needs PutObjectTagging HOT 2
- Setting the runtime of a function to nodejs20.x causes sam validate to fail. HOT 2
- AWS::Serverless::Api - setting "OpenApiVersion" causes "Stage" deployment to be skipped - why? HOT 6
- [Test] GitHub Action automatic comments on GitHub closed Issue HOT 1
- AlwaysDeploy does not include GatewayResponse updates HOT 7
- Please explain how to version AWS::Serverless::Function artifacts cleanly HOT 11
- Bug: AWS::Serverless::Function Policies partly not applied HOT 8
- Cors error from SAM template and Auth enabled. HOT 3
- VSCode SAM Schema Validation Error with !Ref in Conditions Section HOT 7
- Bug: Creates unnecessary AWSLambdaVPCAccessExecutionRole role HOT 7
- Api CORS issue with 500 status after setup Cognito authorizer HOT 3
- Building features for AWS SAM HOT 4
- Can't reset BinaryMediaTypes to a default value for API Gateway REST API HOT 2
- AWS::Serverless::Api auto deploys API when a resource is being added HOT 4
- Layer code update not reflected on Lambda Function HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serverless-application-model.