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

AWS State Machine error when testing locally: ''SCHEMA_VALIDATION_FAILED: Value is not a valid resource ARN

I am trying to locally test my step machine using SAM and the step function Docker for AWS and running into an error when loading my steps following these instructions. Here's what I am loading: aws stepfunctions --endpoint http://localhost:8083…
cyberwombat
  • 38,105
  • 35
  • 175
  • 251
2
votes
1 answer

Problem installing PyODBC for local debugging with AWS SAM CLI

I'm developing a lambda function in Python. The function access RDS database using the pyodbc library. To work with the library I'm using layers. My SAM template looks like this and everything works fine while deployed to AWS. Resources: # ODBC…
Tommy
  • 1,006
  • 3
  • 13
  • 26
2
votes
1 answer

How to remove ptvsd debug code before deploying lambda function

I am developing a serverless app using Python and AWS-SAM-CLI. I am debugging my functions using ptvsd library. In order to attach a debugger, the following snippet has to be in the function code. ptvsd.enable_attach(address=('0.0.0.0', 5890),…
Tommy
  • 1,006
  • 3
  • 13
  • 26
2
votes
2 answers

Python import statement. ModuleNotFoundError: when running tests and referencing a module in a parent folder

Question: How do I fix the import statement in my test file? ================================================ I run the following commands: commands to run up the tests cd cluster_health python -m pytest tests/ -v -s I then get the following…
Banoona
  • 1,470
  • 3
  • 18
  • 32
2
votes
0 answers

AWS SAM build failing for Lambda Java8 when including dependent maven modules

I am implementing a simple lambda handler in Java8. Since many more lambdas are going to be implemented in the future and they all need to be packaged as jars I have structured the maven project with one maven module for each lambda. All works well…
Evan
  • 1,683
  • 7
  • 35
  • 65
2
votes
1 answer

AWS SAM Template Fails to Create Configurations for API Gateway

I have a problem with AWS SAM and provisioning API Gateway configurations. I am trying to do a few things: Configure the API gateway to require api-key in the headers Create my own stage as defined in my config files. The API gateway model defined…
2
votes
0 answers

Visual Studio Code debugger mapping node_module to local folder

I am developing an AWS SAM application in nodejs and have two lambda functions (each are distinct node modules) which both share a third node module which is shared utility functions. I am using the install-local npm module to install the shared…
user3067870
  • 556
  • 1
  • 6
  • 17
2
votes
1 answer

sam local start-api Unable to import module

I just create a lambda function with content (file name is check.js): exports.handler = async (event, context, callback) => { console.log("My message"); }; And content of template.yaml AWSTemplateFormatVersion : '2010-09-09' Transform:…
Trung
  • 135
  • 1
  • 13
2
votes
2 answers

How do I get the name of a dynamically created lambda role?

I like how a role + inline policy is created when I deploy my template: Resources: MyFUnction: Type: AWS::Serverless::Function # More info about Function Resource:…
red888
  • 27,709
  • 55
  • 204
  • 392
2
votes
2 answers

configure iam authorizer in SAM template

I want to control access to my api gateway fronting lambda with iam permissions: https://docs.aws.amazon.com/apigateway/latest/developerguide/permissions.html I have seen no examples of how to configure this in a sam template. What does a sam…
red888
  • 27,709
  • 55
  • 204
  • 392
2
votes
1 answer

AWS Sam Local Environment Variables not available in process.env

With the following AWS SAM template process.env is an empty object. I expect it to contain the environment variable from the template defined as dbURL. AWSTemplateFormatVersion: "2010-09-09" Transform: "AWS::Serverless-2016-10-31" …
2
votes
2 answers

Failed to create/update stack in AWS

I have written code as AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: > sam-app Sample SAM Template for sam-app Globals: Function: Timeout: 300 Api: Cors: …
Sai M.
  • 2,548
  • 4
  • 29
  • 46
2
votes
1 answer

sam local start-api cannot be accessed from outside

I am using aws sam local to developer few lambdas/nanoservices I start the lambda container with: sudo sam local start-api --docker-network db-pros where db-pros is the database container when I go to 127.0.0.1:3000/lambda-name everything works…
user93466
  • 141
  • 2
  • 12
2
votes
0 answers

How to use existing Cloud Formation template to generate SAM Local environment

I'm working on Data Lake project referring AWS Serverless Data Lake. https://github.com/awslabs/aws-data-lake-solution When I try to create SAM local template file I faced some problems with the configuration of existing resources(API Gateway,…
2
votes
1 answer

Cloud formation lambda not picking jar from code build

I tried to use Code Pipeline to automate the code deployment. It uses Git Hub -> Code Build -> Cloud Formation as mentioned in wiki AWS Automation of Lambda I managed to get the pipeline run after few changes suggested by this thread However…
Idicula
  • 203
  • 1
  • 2
  • 7