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
62
votes
5 answers

aws-sam-local environment variables

I am following the readme here: https://github.com/awslabs/aws-sam-local I have a lambda written in python 3.6 and its similar to the helloworld example here :…
gotjava2012
  • 661
  • 1
  • 6
  • 7
49
votes
7 answers

connecting AWS SAM Local with dynamodb in docker

I've set up an api gateway/aws lambda pair using AWS sam local and confirmed I can call it successfully after running sam local start-api I've then added a local dynamodb instance in a docker container and created a table on it using the aws…
Paul D'Ambra
  • 7,629
  • 3
  • 51
  • 96
34
votes
3 answers

AWS Lambda function Timedout after 3 sec using AWS SAM

I am new to AWS and Go and I am trying to execute my Lambda function via AWS SAM CLI. But every time I try to do so I get the following error: I0517 07:51:11.052078 13 main.go:62] Thumbnail Lambda successfully started I0517 07:51:13.696304 …
Stefan Radonjic
  • 1,449
  • 4
  • 19
  • 38
31
votes
4 answers

How do I specify template parameters when running AWS SAM Local?

Using AWS SAM Local I can test my serverless application locally, which is awesome. I can also deploy to AWS, which apparently takes the same flags as aws cloudformation deploy, so I can pass a parameters file with e.g. application secrets (API keys…
Tomas Aschan
  • 58,548
  • 56
  • 243
  • 402
26
votes
5 answers

Git bash will not resolve "sam" command

I am using Win10 latest. After installing AWS-SAM-CLI and testing the installation with: sam --version I get the message bash: sam: command not found however, when I use Powershell, cmd or ConEmu they can all resolve "sam". the path is "e/Program…
Blobafet
  • 419
  • 1
  • 7
  • 13
26
votes
7 answers

Running AWS SAM projects locally get error

I am trying to run an AWS Lambda project locally on Ubuntu. When I run the project with AWS SAM Local it shows me this error: Error: Running AWS SAM projects locally requires Docker. Have you got it installed?
Santosh Silwal
  • 475
  • 1
  • 4
  • 10
22
votes
4 answers

How do I connect to host MySQL from AWS SAM local docker instance?

I am trying to invoke my Lambda function using sam local invoke but find that it cannot connect to my host MySQL. I tried adding --docker-network host but it also cannot connect Traceback (most recent call last): File…
Jiew Meng
  • 84,767
  • 185
  • 495
  • 805
21
votes
2 answers

What's the difference between AWS sam build and sam package when using SAM?

I'm building some serverless apps and trying to use SAM. I've been going through some tutorials and some use sam build, while others use sam package. What are the differences between these commands? It seems like sam package is more difficult to…
19
votes
6 answers

Lambda does not have permission to access the ECR image

With the recent release of Docker Images for Lambda functions, I've decided to try out this functionality using CloudFormation. So, the lambda below considers a docker image stored in Elastic Container Registry, with permissions to access the image…
16
votes
2 answers

AWS Lambda in Python: Import parent package/directory in Lambda function handler

I have a directory structure like the following in my serverless application(simplest app to avoid clutter) which I created using AWS SAM with Python 3.8 as the runtime: ├── common │   └── a.py ├── hello_world │   ├── __init__.py │   ├── app.py │  …
Syed Waqas
  • 2,576
  • 4
  • 29
  • 36
15
votes
3 answers

How to unit test lambda logic which uses layer methods?

Hi I have my AWS Lambda and I wanted to add a layer to it. I would like to be able to just test single methods of lambda. However many of them use layer logic and because of that it doesn't seem to me to be easy. What is the best approach to do this…
Clyde Barrow
  • 1,924
  • 8
  • 30
  • 60
15
votes
1 answer

How do I destroy a aws SAM Local lambda?

Follow the read for an example it says: # AWS SAM Hello World Example # A simple AWS SAM template that specifies a single Lambda function. ## Usage ## To create and deploy the SAM Hello World example, first ensure that you've met the requirements…
red888
  • 27,709
  • 55
  • 204
  • 392
14
votes
3 answers

SAM Local doesn't appear to be running Authorizer functions

I've just gotten started using SAM Local, but am coming up againast an issue when trying to configure an Authorizer function for my endpoints. I've been looking at the main SAM documentation for how to set up the Auth functions, but whenever I try…
cchapman
  • 3,269
  • 10
  • 50
  • 68
13
votes
4 answers

How to export PATH to "sam build" command?

I'm developing AWS Lambda function on PyCharm. When I do "Run" button, Following error message. /usr/local/bin/sam build MyFunction --template /Users/miyashiiii/Works/myapp/myapp/template.yaml --build-dir…
13
votes
4 answers

AWS SAM CLI Fresh install throws error - dyld: Library not loaded: @executable_path/../.Python

I am trying to use the AWS SAM CLI installed through Homebrew and I am seeing the following error when I try to use sam with any command: dyld: Library not loaded: @executable_path/../.Python Referenced from:…
RobertoCuba
  • 881
  • 9
  • 25
1
2 3
34 35