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

Refering to an externally defined API for a Function event in SAM

In my SAM templates, my team has defined an API that is mostly to our liking. I would like to debug this API locally, but it isn't set explicitly as an Event under our Function. So sam local start-api fails with the error Error: Template does not…
Vincent Buscarello
  • 395
  • 2
  • 7
  • 19
0
votes
0 answers

Deploying AWS SAM application does not deploy depedencies for Lambda

I have two SAM applications, both of which have a set of Python Lambdas in common. I have a different template file for each application. When I run sam deploy for the first one it correctly deploys the Lambdas with their dependencies. For the…
Nick Lothian
  • 1,427
  • 1
  • 15
  • 31
0
votes
2 answers

AWS SAM Deploy not updating layer version correctly

Currently deploying to AWS using SAM. When referencing a Layer SAM doesnt seem to update the variable correctly? template.yaml Parameters: HelperFunctionsLayer: Type: String Default: layer-helper-functions:69 ... Outputs: …
ck3mp
  • 391
  • 5
  • 18
0
votes
1 answer

Set User Pool 'App Client Id' as audience for HTTP API AWS YAML - token does not have a valid audience

How do you resolve token does not have a valid audience by adding the correct audience to the aws authorizers? The following snippet from the yaml config will return token does not have a valid audience once I use the Authorization header with a…
0
votes
1 answer

After building and deploying lambda function with aws sam cli, I get Client network socket disconnected in logs

Update: Originally I used the correct callback(null, response) but I needed to also do sam init again for a new project, install a different node version with nvm. I have the following lambda function that creates a new item in datocms using there…
Anders Kitson
  • 1,413
  • 6
  • 38
  • 98
0
votes
1 answer

Cloud9/AWS SAM Environment Variables not consumed by Lambda/NodeJS Debugger

I have a SAM deployment with a SNS Topic and a Lambda/API Gateway. The Lambda is a NodeJS Lambda that is looking for an environment variable sns_create_collection_topic. This is defined in my SAM template as such: Resources: …
Johnathon Sullinger
  • 7,097
  • 5
  • 37
  • 102
0
votes
1 answer

AWS::Serverless::Function CodeUri ignored by 'sam build' (whole project folder copied)?

sam build copies whole project folder instead of lambda function folder(s). I have this project structure: . ├── aws.yaml ├── package.json ├── package-lock.json └── src ├── postAuthentication │   └── main.js └── postConfirmation …
MarMun
  • 91
  • 7
0
votes
1 answer

AWS SAM Template get rule name with intrinsic function

Let's say I have a scheduled function declared in a SAM template.yaml myScheduledFunction: Type: AWS::Serverless::Function Properties: CodeUri: ./bin Handler: myScheduledFunction Policies: -…
Matteo
  • 2,256
  • 26
  • 42
0
votes
1 answer

Use secure string in SAM template

In my template, I can use a configured parameter from systems manager, like this: Parameters: DatabasePassword: Type: 'AWS::SSM::Parameter::Value' Default: '/some/path/db_password' However, I need help to be able to use a secure…
Willem
  • 917
  • 7
  • 19
0
votes
1 answer

Creating a CNAME AWS RecordSet/Custom Domain connection to an API in SAM

I am trying to use Route53 and Custom Domains to link a URL I have and the API gateway that is a Lambda Proxy underneath it. This is what I have so far in my SAM file: MyApiCertificate: Type: 'AWS::CertificateManager::Certificate' Properties: …
VoltreX
  • 301
  • 1
  • 8
0
votes
1 answer

Not working Reddison client in Java Lambda(using samLocal and localstack)

I'm not sure what's causing this to not work. Everytime the code hits the initialization of the client, it stop working Is using Redisson not viable in a Lambda setup? Main code for initializing redisson client: public boolean…
gzz
  • 655
  • 5
  • 18
0
votes
1 answer

Moving to AWS::Serverless from AWS::Lambda for changing deployment preference of lambdas

Currently we are using AWS::Lambda:Function in yaml file for cloudformation for our service. I have to change deployment preference for the lambdas present in our service. But there seems to be no key in AWS::Lambda:Function for doing that. So I was…
0
votes
0 answers

Exception in SAM server-less application : (Access Denied): AggregateException

I have sam app that declares S3 bucket, lambda function and DynamoDB table, when a CSV file is uploaded to the S3 bucket, it triggers the lambda function that parses and stores the records into the DynamoDB table, after I'm uploading the CSV file to…
Tarik Ziyad
  • 115
  • 1
  • 10
0
votes
1 answer

aws sam cli-colored output in jenkins console

From version 0.33.1 onwards, aws-sam-cli supports colored output. I'm trying to run the sam deploy command from Jenkins pipeline and the output is not displaying in colored format. I've installed ANSIColor Jenkins plugin and wrapped the sam deploy…
Haran
  • 1,040
  • 2
  • 13
  • 26
0
votes
1 answer

Can I share ScalableTarget or ScalingPolicy in CloudFormation?

I have multiple AWS lambdas defined in my CloudFormation template. I want to define scaling for ProvisionedConcurrency for all of them, say to have minimum 1 provisioned lambda and maximum 4. Then I have scaling config for one lambda that looks like…