Questions tagged [aws-sam]

AWS Serverless Application Model (AWS-SAM) is an open source framework used to define, test and deploy serverless applications to the AWS Cloud.

From the Developer Guide:

Benefits of Using AWS SAM

Because AWS SAM integrates with other AWS services, creating serverless applications with AWS SAM provides the following benefits:

Single-deployment configuration

. AWS SAM makes it easy to organize related components and resources, and operate on a single stack. You can use AWS SAM to share configuration (such as memory and timeouts) between resources, and deploy all related resources together as a single, versioned entity.

Extension of AWS CloudFormation.

Because AWS SAM is an extension of AWS CloudFormation, you get the reliable deployment capabilities of AWS CloudFormation. You can define resources by using AWS CloudFormation in your AWS SAM template. Also, you can use the full suite of resources, intrinsic functions, and other template features that are available in AWS CloudFormation.

Built-in best practices.

You can use AWS SAM to define and deploy your infrastructure as config. This makes it possible for you to use and enforce best practices such as code reviews. Also, with a few lines of configuration, you can enable safe deployments through CodeDeploy, and can enable tracing by using AWS X-Ray.

Local debugging and testing.

The AWS SAM CLI lets you locally build, test, and debug serverless applications that are defined by AWS SAM templates. The CLI provides a Lambda-like execution environment locally. It helps you catch issues upfront by providing parity with the actual Lambda execution environment. To step through and debug your code to understand what the code is doing, you can use AWS SAM with AWS toolkits like the AWS Toolkit for JetBrains, AWS Toolkit for PyCharm, AWS Toolkit for IntelliJ, and AWS Toolkit for Visual Studio Code. This tightens the feedback loop by making it possible for you to find and troubleshoot issues that you might run into in the cloud.

Deep integration with development tools.

You can use AWS SAM with a suite of AWS tools for building serverless applications. You can discover new applications in the AWS Serverless Application Repository. For authoring, testing, and debugging AWS SAM–based serverless applications, you can use the AWS Cloud9 IDE. To build a deployment pipeline for your serverless applications, you can use CodeBuild, CodeDeploy, and CodePipeline. You can also use AWS CodeStar to get started with a project structure, code repository, and a CI/CD pipeline that's automatically configured for you. To deploy your serverless application, you can use the Jenkins plugin. You can use the Stackery.io toolkit to build production-ready applications.

1001 questions
0
votes
1 answer

AWS Toolkit for Visual Studio Code using the AWS Serverless Application Model AWS SAM

I follow the steps described at Create a Serverless Application with the AWS Toolkit for Visual Studio Code: https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/create-sam.html This is step by step building a lambda function with AWS…
Eralper
  • 6,461
  • 2
  • 21
  • 27
0
votes
1 answer

How to fix 'WaiterUnrecoverableException' when using the Jenkins SAM plugin to build a serverless app

I have a very simple Jenkins job that builds and then deploys a step function to AWS. I have been able to build and deploy from my desktop using the SAM cli no problem. However, when I set up jenkins to do it I get the following error: ERROR: Build…
user3236794
  • 578
  • 1
  • 6
  • 16
0
votes
2 answers

AWS SAM Lambda function to upload to S3 returns invalid response

I'm trying to write a Lambda function to upload a file to S3, using AWS SAM... I'm testing it locally but it looks like nothing is happening and the lambda function ends with invalid response. No other errors are logged. What is going on? This is…
June
  • 592
  • 8
  • 18
0
votes
1 answer

How to change the default program run under zsh?

I have two versions of AWS SAM CLI installed on my MacOS. I got the following result when running where sam in zsh: $ where sam /Users/MyName/.pyenv/shims/sam /usr/local/bin/sam When running sam command, MacOS runs the sam under…
Brian
  • 12,145
  • 20
  • 90
  • 153
0
votes
1 answer

SAM Template - Always enable event trigger for lambda

I have a lambda function created using SAM template which has an event trigger scheduled every 5 mins. When the lambda get created for first time the event is enabled. But, when someone disables the trigger manually, the rerunning the stack does not…
Jophine
  • 584
  • 1
  • 5
  • 10
0
votes
1 answer

SAM template "Invalid template property or properties [MyApi]"

I am getting the following error after running CLI command aws cloudformation deploy (after sam package) "Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason:…
jhurtas
  • 555
  • 1
  • 6
  • 17
0
votes
1 answer

SAM template for an application containing independent modules

I'm developing backend for web application. The backend is split into several modules e.g. orders, products, etc. These modules share some common resources such as DynamoDB table, SNS topic. I'd like to be able to deploy the modules…
bikerp
  • 101
  • 2
  • 8
0
votes
1 answer

cannot load such file -- mysql2

sam build is working well for me, except when I include the mysql2 gem, which happens to be compiled. When I include this gem, lambda tells me that it cannot find mysql2. Looking in my…
Dave
  • 2,735
  • 8
  • 40
  • 44
0
votes
1 answer

how to add plugin in aws-sam template.yaml file

is there any way to add custom plugin in aws-sam template.yaml file like Serverless.yml file for eg: plugins: - plugin-1 - plugin-2 custom: abc: accountId: "************"
0
votes
1 answer

Problem writing Lambda logs to CloudWatch, what could be wrong?

I'm with some problems trying to write my Lambda function logs to CloudWatch Logs. It seems it is not a problem of authorization as you can see below: PolicyDocument: Version: 2012-10-17 Statement: - Effect: Allow …
0
votes
2 answers

How can I configure AWS SAM to use existing database?

In all the examples I can find, it seems that the SAM template creates a new DynamoDB table. How can I configure it to point to existing tables?
yasgur99
  • 756
  • 2
  • 11
  • 32
0
votes
0 answers

How to configure different APIGateway endpoints for lambda versions $LATEST and live AutoPublishAlias

I'm using SAM with AutoPublishAlias safe lambda deployments. However, in the Pretraffic hook, I'd like to run some initial validation tests by invoking the latest [unvalidated] lambda version through an AWS API Gateway endpoint that's different from…
Kes115
  • 2,070
  • 2
  • 21
  • 37
0
votes
1 answer

How do I do "/" for an API event in my template?

This is my lambda resource: Resources: myFunction: Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction …
red888
  • 27,709
  • 55
  • 204
  • 392
0
votes
2 answers

"sam local start-api" fails with "invalid volume specification" on (Windows 10 Pro, Docker for Windows)

I am using SAM CLI 0.6.0 and I am getting the error below when running sam local start-api with the app generated using sam init --runtime java PS C:\Users\Kiran\AWS\SAM\java-sample\sam-app> sam local start-api 2018-09-03 10:49:49 Mounting…
Kiran P
  • 9
  • 2
0
votes
1 answer

AWS Lambda CloudTrail Events SAM Mapping

Could you please provide information/link how can I create next via AWS SAM: 1. Go to services → CloudWatch → Rules → click on Create rule . 2. Event Source → choose Event Pattern → select CloudWatch Logs in Service Name , AWS API Call via…
1 2 3
66
67