Skip to content
This repository was archived by the owner on Apr 30, 2024. It is now read-only.
This repository was archived by the owner on Apr 30, 2024. It is now read-only.

Multiple Lambda functions from the sam.yml file possible? #5

@joelfogue

Description

@joelfogue

I have a situation where I have multiple lambda functions within our API Gateway's API.
I'm new to AWS and learning as much as I can.
I am wondering, how would I change the template yaml (sam.yaml) so that we can deploy to any number of lambda functions and not just one as is the case in this lab.
Would you create multiple index.js file per lambda function?

  • so index1.js -> will map to first lambda function
  • index2.js -> second lambda function;
  • etc....

And how do I update the sam.yaml file to reflect this change?

Here's a snippet code of what I'm trying to accomplish:

Resources:
  HelloWorld:
    Type: AWS::Serverless::Function
    Properties:
      Handler: index.handler
      Runtime: nodejs4.3
      Role:
        Fn::ImportValue:
          !Join ['-', [!Ref 'ProjectId', !Ref 'AWS::Region', 'LambdaTrustRole']]
      Events:
        GetEvent:
          Type: Api
          Properties:
            Path: /
            Method: get
        PostEvent:
          Type: Api
          Properties:
            Path: /
            Method: post
.... and more endpoints here to hit more lambda functions? So do I create multiple index.js to map to each individual lambda function?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions