Questions tagged [aws-sam-cli]

AWS SAM Local allows developers to run & debug AWS Lambda code on local machine using Docker. AWS Lamda is a part of Amazon Web Services (AWS).

AWS SAM Local allows developers to run & debug AWS Lambda code on local machine using Docker. AWS Lamda is a part of Amazon Web Services (AWS).

Resources

512 questions
6
votes
1 answer

Access files written into /tmp with aws sam local

I am working on a project using AWS SAM local. I am invoking a function with sam local invoke which successfully executes the function. The lambda function writes an image file into /tmp/image.png when the function is invoked. This writing operation…
tiivik
  • 91
  • 5
6
votes
1 answer

How to run a AWS lambda via SAM local that writes to an S3 bucket?

I'm looking at running some of our AWS lambdas locally via SAM, including a one that writes to an S3 bucket. Is there a way of getting S3 to run locally, or talk to an S3 bucket in the cloud and write to that while running the lamda locally?
jamesdwalker
  • 103
  • 1
  • 5
6
votes
1 answer

sam build is unable to locate the pom.xml file

I have a Maven Project which has a module 'AddUser'. This module is basically a sam application. When trying to run the command 'sam build' from the project root path. I am getting the below error:- in-iftekhar-04eb:UserPlanning iftekhar.khan$ sam…
Sunny
  • 858
  • 3
  • 17
  • 39
6
votes
3 answers

Step Functions AWS SAM CLI Local Connection Refused Error

Following the steps in the AWS documentation https://docs.aws.amazon.com/step-functions/latest/dg/sfn-local-lambda.html using aws-stepfuncitons-local docker container I'm getting a connection refused error at the last step 2019-05-28 12:37:05.004:…
Axe
  • 764
  • 6
  • 29
6
votes
3 answers

AWS SAM Template - Define SQS queue triggered by API Gateway

I'm facing a problem when trying to deploy my stack via AWS SAM CLI. I'm using the SAM simplified template which I package and deploy. All I want is to create an SQS queue and implicitly create an API Gateway that will just put the payload into the…
6
votes
1 answer

Recommended Project Structure for multi-function SAM Template

I have a new project that requires a relatively small amount of services, maybe 10 or less (and therefore it is not economical to place each in a separate project repository). Each service will be defined as an AWS::Serverless::Function via SAM…
Kwhitejr
  • 2,206
  • 5
  • 29
  • 49
6
votes
1 answer

AWS SAM: No 'Access-Control-Allow-Origin' header is present on the requested resource response

I'm working to get a static website to call API gateway using CORS. I've got the code below running using SAM local, but I'm getting the following CORS error trying to call my API with jQuery from my static website (hosted locally): Failed to load…
6
votes
1 answer

Serverless or SAM and local development with SQS, SNS, and APIGW

I am evaluating serverless v AWS SAM CLI. I am trying to understand how can i facilitate a local dev workflow when developing using the following:- Lambda’s written in python Triggered by SNS notifications with an SES mail payload Reading S3…
Simon Taylor
  • 607
  • 1
  • 9
  • 27
6
votes
1 answer

How to specfiy existing FunctionName on SAM Template

I'm trying to deploy AWS Lambda function by using SAM. What I want to do is to update exsiting lambda function by deploying local source code. In order to do that, I specified the existing lambda function name as 'FunctionName' in template.yaml like…
Tamajin
  • 155
  • 5
6
votes
0 answers

AWS cli/sam-local package env.json

I am using aws-sam-local to write, test and deploy some Lambda functions. Using the -env-var option I can pass env.json when testing locally, so my lambdas get properties I don't have to source control. How do I publish these values? The…
OnIIcE
  • 811
  • 9
  • 27
6
votes
2 answers

How to Set Up Debugging with Dockerized SAM Local

I'm working on a project using AWS Lambda with Node.js. We use Docker containers for our development environment. Our current setup spins up AWS SAM local on port :3000. It runs start-api and mounts the functions in my template.yml file. I test…
5
votes
1 answer

How to connect a lambda to a database accessible locally on Mac's localhost when using sam

Background I have a lambda that is connected to a RDS database. The RDS database and lambda are in a VPC. The db is only accessible to developers via a Bastion instance. During development we can test the lambda using sam. This works fine for APIs…
bluprince13
  • 4,607
  • 12
  • 44
  • 91
5
votes
2 answers

AWS SAM giving error Unsupported Lambda runtime nodejs18.x

I am trying to run a simple lambda function using AWS sam, version(1.57.0) I've installed in my ubuntu system nodejs version 14.18.3 When I try to run the project it gives errorUnsupported Lambda runtime nodejs18.x Below is the full…
5
votes
0 answers

api gateway rest api geolocation headers

I am using AWS SAM CLI According to https://aws.amazon.com/about-aws/whats-new/2020/07/cloudfront-geolocation-headers/ geolocation is already supported and CloudFront returns with the geolocation headers; example: CloudFront-Viewer-Country-Name:…
5
votes
1 answer

How do I see the full logs of a local invocation of a Lambda via SAM?

I am using the default HelloWorld example My code is: let response; exports.lambdaHandler = async (event, context) => { console.log(event); try { response = { 'statusCode': 200, 'body': JSON.stringify({ …
Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278