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

AWS SAM DockerBuildArgs It does not add them when creating the lambda image

I am trying to test a lambda function locally, the function is created from the public docker image from aws, however I want to install my own python library from my github, according to the documentation AWS sam Build I have to add a variable to be…
3
votes
1 answer

Unable to find module - AWS Sam CLI Local Invoke with HelloWorld Example (Windows / Rancher Desktop)

With the recent subscription changes to Docker desktop, I am attempting to run SAM CLI on windows using Rancher desktop as an alternative. While AWS SAM does not officially support Rancher, I have colleagues who have successfully done this. I…
3
votes
1 answer

What is the difference between PackageType: Image and build --use-container in a SAM App?

PackageType: image seems to require a Dockerfile (looking at the hello-world example) along with ImageUri and Metadata And it also doesn't want me to use Runtime, Handler, Layers (not even using layers) whereas build --use-container does not seem to…
3
votes
0 answers

Debugging AWS SAM in VSCode - Don't stop debugger at wrapper entry file

I've created a AWS SAM project using nodejs14.x. I've been able to get debugging working, but every time I run my program it stops on an AWS wrapper index.js file. See this link for a picture of the actual file. It looks like the file is located at…
3
votes
0 answers

Use library for `SAM` lambda project

I am developing lambda project by SAM My simple python script using pandas import json import requests import pandas as pd def lambda_handler(event, context): return { "statusCode": 200, "body": json.dumps({ …
whitebear
  • 11,200
  • 24
  • 114
  • 237
3
votes
1 answer

How should I inject env vars with sam build

I am using AWS SAM. I have created a samconfig.toml file with the following entry: [default.build.parameters] container_env_var_file = "envDefault.json" When I do sam build I see in .aws-sam/build.toml The env values from envDefault.json But when I…
3
votes
1 answer

Visual Studio Code \n in Output & Debug Console

I'm using Visual Studio Code to create a AWS Lambda SAM applications with Python 3.9.7 on a Windows 10 machine. I'm using the AWS Toolkit and Python extensions in Visual Studio Code. When running/debugging Lambda SAM applications, the Visual Studio…
DWard
  • 31
  • 3
3
votes
1 answer

VS code terminal can't find AWS SAM even though windows terminal can

I installed AWS SAM from the msi installer from AWS for windows. after running the installer, I ran sam --version in cmd and powershell. PS C:\Users\dgupta> sam --version SAM CLI, version 1.26.0 It returns the version I just installed. However in…
Dhruv
  • 645
  • 9
  • 17
3
votes
1 answer

AWS SAM Incorrect region

I am using AWS SAM to test my Lambda functions in the AWS cloud. This is my code for testing Lambda: # Set "running_locally" flag if you are running the integration test locally running_locally = True def test_data_extraction_validate(): if…
3
votes
0 answers

AWS CDK: Api Key ignored when testing api gateway locally?

I'm currently developping an API with aws-cdk and I'm testing it locally with aws-sam-cli and docker. I wanted to add the requirement of an API Key to call the API. Here is the code inside my stack: const api = new apigw.RestApi(this, "MyAPI", { …
Amo
  • 333
  • 3
  • 12
3
votes
2 answers

How to access SSM Parameter Store from SAM lambda local in node

I have a lambda with node and for local deployment I am using SAM CLI. This lambda requires some parameters in the SSM parameter store to be able to connect to the DB. I configured the AWS_ACCES_KEY_ID and AWS_SECRET_ACCESS_KEY, as environment…
3
votes
2 answers

Why does AWS SAM CLI (awssamcli) fail to build when using Global section?

I just found out about the Global section which seems very useful in cleaning up the template.yaml for AWS SAM cloud formation templating. After completing the Global section I remove the Runtime from my lambda (since it should inherit Runtime from…
Liam Hanninen
  • 1,525
  • 2
  • 19
  • 37
3
votes
1 answer

How to solve "Transform AWS::Include failed with: The specified S3 object's content should be valid Yaml/JSON" in SAM template

I'm trying to include an OpenApi specification into my AWS::Serverless::Api DefinitionBody like so: MyApi: Type: "AWS::Serverless::Api" Properties: StageName: 'dev' Domain: DomainName: 'mydomain.com' …
Je Suis Alrick
  • 3,404
  • 2
  • 16
  • 23
3
votes
0 answers

SAM AWS Lambda Works But Never Returns while Reporting a Timeout Issue

I have a weird issue running AWS SAM Lambda functions which I discovered through the AWS SAM API tools. My lambda request fully completes but no response is received by the call to the function. Technology: Windows 10 + AWS CLI + AWS SAM + IntelliJ…
3
votes
2 answers

How can I download/pull lambda code to a local machine from command line?

I am using the sam deploy command with the AWS SAM command line tool to deploy. Now I made some changes with the web IDE in the AWS Console. How can I pull the changes to the local machine, so that the next sam deploy command won't override them? (I…
Crocodile
  • 5,724
  • 11
  • 41
  • 67