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
4
votes
1 answer

AWS SAM: Use an existing SQS Queue in template

I have a lambda function that is supposed to be triggered when a message arrives in my queue. I am developing & deploying this function via SAM cli. But, the SQS queue already exists and I can not create it along with the lambda function due to a…
hkjhadj1
  • 848
  • 3
  • 13
  • 32
4
votes
2 answers

run locally Step Function defined in a SAM template

I follow the guide https://docs.aws.amazon.com/step-functions/latest/dg/sfn-local-lambda.html to run locally a Step Function defined inline. But I don't found any guide how to test locally a Step Function defined into a SAM template…
Hey Teacher
  • 1,215
  • 13
  • 17
4
votes
1 answer

How to set up Custom Domain names with Route53 in AWS SAM Cloud-Formation

ORIGINAL QUESTIONS: How to get RegionalDomainName out of a AWS APIGateway DomainName in SAM Cloud-formation EDIT: I changed the question to hopefully get more traffic to this answer as it answers several questions not just my original one. I am…
4
votes
4 answers

AWS SAM: Could not install from function as it does not contain a package.json file

I'm using AWS SAM in Visual Studio Code to set up a number of Node.js lambda functions. I am using Windows 10. I'm only starting out with AWS SAM and I've generated the Sample Hello World App using the Command Palette and it works. I started…
Stanley
  • 5,261
  • 9
  • 38
  • 55
4
votes
0 answers

Sam local with NodeJS - where does request spend so much time

I have written a NodeJS lambda function and I am testing it locally with sam local. I have noticed the browser takes much more time to download it than I can see the lambda execution from the logs. Chrome shows that it waited 6,13 seconds before the…
Leos Literak
  • 8,805
  • 19
  • 81
  • 156
4
votes
2 answers

How do you get the API endpoint's URL when it's created within the Events property of Cloudformation's Lambda definition

I'm creating a Lambda function via CloudFormation (AWS' SAM: Serverless Application Model) and have defined an API endpoint via the Lambda-function's Events property. ... MyFunction: Type: AWS::Serverless::Function Properties: …
4
votes
0 answers

sam local invoke cannot find lambda layers image

I have defined a lambda layer in my Sam template, however Im having this issue. I havent found any related article that has this kind of error. 2019-09-01 16:10:14 Invoking app.lambda_handler (python3.7) 2019-09-01 16:10:14 Found credentials in…
XDProgrammer
  • 853
  • 2
  • 14
  • 31
4
votes
1 answer

What action does iam:PassRole api perform?

In the below rule: { "Condition": { "StringLikeIfExists": { "iam:PassedToService": "lambda.amazonaws.com" } }, "Action": [ "iam:PassRole" ], "Resource": [ …
overexchange
  • 15,768
  • 30
  • 152
  • 347
4
votes
2 answers

Dockerfile - Could not find a version that satisfies the requirement serverlessrepo==0.1.5

Below is the Dockerfile for aws sam: FROM buildpack-deps:stable ARG PYTHON_VERSION=3.7.4 # Update and allow for apt over HTTPS RUN apt-get update && \ apt-get install -y apt-utils RUN apt-get install -y apt-transport-https # download and build…
overexchange
  • 15,768
  • 30
  • 152
  • 347
4
votes
1 answer

How to create an SQS queue with cloudformation/SAM that works with lambdas created with SAM?

I am creating lambdas from the AWS SAM, mostly they are working well but I am not sure how to grant permission for these lambda's to be triggered by SQS. Whenever I build/package/deploy I am trying to manually add an SQS trigger from the console and…
user3062260
  • 1,584
  • 4
  • 25
  • 53
4
votes
1 answer

How do I create a rule with CloudFormation that calls a Gateway API every few minutes?

I'm trying to create a CloudWatch rule in CloudFormation that triggers one of our Gateway APIs every few minutes and I'm having trouble finding documentation on how to fill certain parts of the template. For example, this is what we have in our CF…
4
votes
3 answers

Requirements file not found while deploying SAM tutorial app

I want to start using aws-sam to test locally my lambdas. I tried to the tutorial from https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-quick-start.html I created example app using sam init --runtime…
Clyde Barrow
  • 1,924
  • 8
  • 30
  • 60
4
votes
2 answers

API Gateway Options method throwing 403

I have a Custom Authorizer with API Gateway. When deployed through SAM Module it also creates Options Method when you enable CORS. The thing I really don't understand is why the custom authorizer gets attached to Options endpoint? This is throwing…
4
votes
2 answers

How to configure AWS SAM on Eclipse and Window 10

I am using STS 4 (https://spring.io/tools) and added Eclipse AWS toolkit (https://marketplace.eclipse.org/content/aws-toolkit-eclipse) . After restart STS we can see everything is good. Now i have installed AWS SAM CLI local And configured path…
vaquar khan
  • 10,864
  • 5
  • 72
  • 96
4
votes
2 answers

How to configure asynchronous lambda invocation via API Gateway using SAM?

I have configured a lambda proxy integration with API Gateway using SAM specification and am invoking the lambda asynchronously by passing X-Amz-Invocation-Type: "'Event'" header ApiGateway: Type: AWS::Serverless::Api Properties: …