I'm currently developing a SAM application and when I compare running sam deploy with vs. without invoking sam build beforehand, both seem to work. What's the difference? Can I skip sam build?
Related
I am trying to use sam cli for remote development, but the issue is sam sync doesnt work if the package type is images.
Any one got this working who could share his thoughts ?
Using sam accelerate for native lambda runtime vs containers on lambda
I'm rather new to AWS Lambda and Step Functions, and the serverless framework in general. From my understanding, we can deploy an entire service via CloudFormation using the command serverless deploy. However to save time, we can just update specific Lambda functions we have made changes to, by using serverless deploy function -f myFunction.
Is there an equivalent of this for Step Functions so that I don't have to redeploy the entire service whenever I only make a change to the Step Function? I have already tried serverless deploy function -f myStepFunction but I simply get a Serverless Error that it does not exist in the Service.
You have to use the step functions plugin, using this you first do sls deploy which will deploy the state machine for you.
Now if you don't change the state machine diagram, then you can simply do sls deploy -f functionName to deploy the individual functions.
I have a SAM project to deploy my app, I deploy this stack using sam build and sam deploy
I recently added a codepipeline (with all its resources) to the template. The problem is that when I deployed the app, code pipeline created another stack.
Is there a way to mantain only 1 stack?
If not I must separate them as nested stack o different stacks?
TLDR; Adding CodePipeline to a SAM app necessitates an additional CloudPipeline stack.
The Codepipeline stack is independent of the "app stacks". This loose coupling is helpful:
Can deploy the app manually via sam deploy for testing, while using the pipeline for prod.
Can clone the app to multiple regions or accounts with pipeline stages
Can add fancy test or approval actions in the pipeline without touching the app code
(It also seems like this setup helps AWS avoid tricky chicken-and-egg dependency problems of having to bootstrap the pipeline before deploying on the app resources.)
I used Visual Studio 2017 with the AWS Toolkit to develop a .Net Core lambda function. I have Cloudformation script in a file called serverless.template and a deployment configuration in a file called aws-lambda-tools-defaults.json. While developing the project I've been deploying it to an AWS development account using the 'Publish to AWS Lambda...' right click option in the Solution Explorer.
I'm now ready to move to deploying this to our staging and production AWS accounts and need to perform the 'Publish to AWS Lambda...' deployment step using Cloudformation, with an ambition that we create Cloudformation Change Sets, to allow review prior to deployment.
I've been trying to work out what to do and have experimented with the 'aws cloudformation package' and 'sam package' CLI commands, but I can't seem to find a way forward.
Can anyone help me to understand the steps which 'Publish to AWS Lambda...' performs? I'd like to reproduce the steps in Powershell as this will provide me with the understanding I need to move on.
Thanks.
To deploy from the command line, use the dotnet CLI extension for Lambda. It's the same code that runs inside Visual Studio when you publish from the wizard, and can read the defaults file etc so you get a consistent deployment experience regardless of whether you deploy from the IDE or the command line.
You mention you want to understand what's going on behind the scenes - these tools are open source so you can take a look at all the work it does for you in this GitHub repository. When deploying a serverless application, CloudFormation change sets are used automatically, you don't need to handle it yourself.
The tool is a .NET Core global tool which you first install from the command line:
dotnet tool install -g Amazon.Lambda.Tools
Once installed, you can get help etc:
PS C:\> dotnet lambda help
Amazon Lambda Tools for .NET Core applications (3.2.0)
Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet
Commands to deploy and manage AWS Lambda functions:
deploy-function Command to deploy the project to AWS Lambda
invoke-function Command to invoke a function in Lambda with an optional input
list-functions Command to list all your Lambda functions
delete-function Command to delete a Lambda function
get-function-config Command to get the current runtime configuration for a Lambda function
update-function-config Command to update the runtime configuration for a Lambda function
Commands to deploy and manage AWS Serverless applications using AWS CloudFormation:
deploy-serverless Command to deploy an AWS Serverless application
list-serverless Command to list all your AWS Serverless applications
delete-serverless Command to delete an AWS Serverless application
Commands to publish and manage AWS Lambda Layers:
publish-layer Command to publish a Layer that can be associated with a Lambda function
list-layers Command to list Layers
list-layer-versions Command to list versions for a Layer
get-layer-version Command to get the details of a Layer version
delete-layer-version Command to delete a version of a Layer
Other Commands:
package Command to package a Lambda project into a zip file ready for deployment
package-ci Command to use as part of a continuous integration system.
To get help on individual commands execute:
dotnet lambda help <command>
To deploy your project from the command line, first cd into the project folder then execute the command
dotnet lambda deploy-serverless
This will read the settings in the defaults file and perform the deployment for you, just as if you'd used the IDE wizard.
Hope this, in conjunction with the open source repo, helps you dig into the steps involved.
I am working to extend this solution https://github.com/adieuadieu/serverless-chrome to my needs.
I am using serverless (on my laptop with Debian 9) to deploy it to AWS Lambda. I would like to use AWS-Sam-local https://github.com/awslabs/aws-sam-local to run it locally for developing.
I would like to use AWS-Sam-local because I believe that there is difference between running this solution via serverless webpack serve --function run and sam local start-api. The difference I think, is event object which I want to make contain POST or binary data (multipart files transfer). For that I have to allow binary transfer via API Gateway.
But correct me if I am wrong because I am totally green in the AWS and Serverless field and this is my first time with this technologies.
The problem I get is aws-sam-local needs the CloudFormation template to know how to run serverless-chrome project. If I make deploy to AWS and go to CloudFormation Console I can copy that template after selecting it in "Stacks" table and clicking "Template" tab. Then I use cfn-flip to convert JSON into YAML. In the end I got template.yml, but running sam local start-api gives me error:
2017/10/06 11:03:23 Connected to Docker 1.32
ERROR: No Serverless functions were found in your SAM template.
Please tell me what to do to make serverless-chrome run locally as it would run on AWS Lambda.
The templates Serverless uses to deploy are available in two places:
Remotely, in the S3 deployment bucket
locally, in .serverless/