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

How do I access another Docker container (running a node express server) from a AWS SAM Local Docker container?

We are developing locally using SAM Local to invoke a Lambda in an API Gateway. SAM Local does this using a Docker container (setup as close to the Lambda node runtime as possible). We want this Lambda to access some data in an API Mocking service…
SamBrick
  • 681
  • 1
  • 8
  • 33
2
votes
1 answer

How to access DynamoDB table from Lambda in a SAM Template?

I've been working on a website that shows my resume and also has a visitor count on it while using AWS Services. I've gotten a "hard coded" way but now would like to be able to deploy the API Gateway, Lambda code, and DynamoDB all in one go if I…
2
votes
0 answers

Error creating AWS lambda function using "sam build"

When running sam build --use-containers to create an AWS python 3.8 lambda function that uses a downloaded library, I am getting an error: pip._vendor.requests.exceptions.SSLError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max…
2
votes
1 answer

distutils.util missing after upgrading to 3.8

I just upgraded to Pop OS(Ubuntu) 20.04, which upgraded Python 3.7 to 3.8. Now I get this error below when I run sam (from the AWS SAM CLI). Solutions found online all had to do with making sure python3-distutils is installed. I have verified that…
jingx
  • 3,698
  • 3
  • 24
  • 40
2
votes
1 answer

AWS SAM local API cannot access Systems Management parameters

I have an C# AWS Lambda function created using AWS SAM. The function tries to get parameters from Systems Management using this code: public async Task GetConfiguration(string parameterName) { var request = new GetParameterRequest { …
infojolt
  • 5,244
  • 3
  • 40
  • 82
2
votes
1 answer

"Bucket name must match the regex" error when using AWS SAM

Using aws-sam-cli==0.48.0 I am trying to upload a lambda inside an existing folder of an AWS S3 bucket. The path is "my-modelling/lambdas" When I execute this command on a MacOS command line: sam package --template-file template.yaml…
Javide
  • 2,477
  • 5
  • 45
  • 61
2
votes
1 answer

sam build --use-container failed but sam build is success

The issue happens in the following setup: Virtual Machine launched in OpenStack OS is Ubuntu 16.04 LTS Python version 3.7.6 with virtualenv installed SAM CLI version 0.39.0 To replicate the issues, you may use the above setup and perform the…
Zhang Ran
  • 196
  • 2
  • 9
2
votes
1 answer

Unable to switch from AWS Layer to specifying locally built editable pip3 packages when executing function

I'm both learning python and attempting to build multiple lambdas that will both store and process Spotify listening history. I originally wrote one lambda with all dependencies packaged in the same directory and imported using relative paths. Once…
MikeMelo91
  • 121
  • 3
  • 11
2
votes
2 answers

AWS SAM YAML File not able to refer to an existing bucket for S3 event

Use Case : Refer to an existing bucket while creating a S3 event for the Lambda function in SAM YAML file AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Sample SAM Template for sam-app Globals: …
K.Pil
  • 786
  • 2
  • 10
  • 24
2
votes
2 answers

SAM Template - API Authorizor to use existing Cognito User Pool

UPDATE: Thanks for the help! I've updated the template.yml to include the Authorizer, but I'm getting an error still: HelloWorldApi: Type: AWS::Serverless::Api Properties: StageName: Prod Cors: "'*'" # Auth: # …
2
votes
1 answer

Using a pre-built docker container image with the requirements pre-installed

I'm looking at a way to run a docker container with all the requirements already provided to avoid to wait on the download of the requirements. I'm debugging python lambda locally. I use the sam-cli integration in PyCharm. To specify the…
Yair Carel
  • 21
  • 1
2
votes
1 answer

`sam local invoke`error 'NameError: name 'NpipeHTTPAdapter' is not defined'

I am writing a lambda function just to get some data from an AWS RDS table. I am able to successfully run sam package and sam deploy to deploy the function to AWS. When I run sam build it successfully builds and then I run sam local invoke to test…
jthomas
  • 65
  • 6
2
votes
1 answer

AWS Sam package command failing during buildspec

I'm trying to package/deploy my AWS SAM Lambda function written with dotnet core. I have 3 files: pipeline.yml is a CloudFormation template creating a CodeBuild project, sets environmental variables, and wires up GitHub webhook to a specific…
Tom Schreck
  • 5,177
  • 12
  • 68
  • 122
2
votes
1 answer

AWS SAM - get error message : pywintypes.error: (5, 'CreateFile', 'Access is denied.')

When i run the following command : sam local invoke HelloWorldFunction --event ./events/event.json i get the following message : pywintypes.error: (5, 'CreateFile', 'Access is denied.') im attempting to run a lambda\python locally but i get the…
pb123
  • 73
  • 1
  • 6
2
votes
1 answer

How to write a policy in .yaml for a python lambda to read from S3 using the aws sam cli

I am trying to deploy a python lambda to aws. This lambda just reads files from s3 buckets when given a bucket name and file path. It works correctly on the local machine if I run the following command: sam build && sam local invoke --event…
user3062260
  • 1,584
  • 4
  • 25
  • 53