Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

424
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda