Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

425
Views
Invoke AWS SAM local function from another SAM local function

I am trying to create an AWS SAM app with multiple AWS Serverless functions.

The app has 1 template.yaml file which have resource of 2 different serverless lambda functions, for instance "Consumer Lambda" and "Worker Lambda". Consumer gets triggered at a rate of 5 minutes. The consumer uses boto3 library to trigger the worker lambda function. This code works when the worker lambda is deployed on AWS.

But I want to test both the functions locally with Sam local invoke "Consumer" which invokes "Worker" also locally.

Here's a screenshot of the YAML file:

I am using Pycharm to run the project. There is an option to run only 1 function at a time which then creates only one folder in the build folder.

I have to test if Consumer is able to invoke worker locally in pycharm before deployment. I think there is some way to do it but not sure how to. I did some extensive search but didn't yield anything.

Any help is appreciated. Thanks in advance

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can start the lambda invoke endpoint in the following way (official docs):

sam local start-lambda

Now you can point your AWS resource client to port 3001 and trigger the functions locally.

For eg. If you are doing this on Python, it can be acheived in the following way with boto3:

boto3

# Create a lambda client
lambda_client = boto3.client('lambda',
                             region_name="<localhost>",
                             endpoint_url="<http://127.0.0.1:3001>",
                             use_ssl=False,
                             verify=False)

# Invoke the function
lambda_client.invoke(FunctionName=<function_name>,
                     Payload=<lambda_payload>)
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!