7

I have the follwing folder structure

src
-- foo
  --lambda1.py
-- blah
   --lambda2.py
-- util
    --util.py

Now i would to create to include util.py in both the lambda functions code uri using the template.yaml.So that i dont have to maintain two copies of same util.py in lambda1 folder and lambda2 folder.

Here is the template.yaml i am using :

AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
  SAMDEMOLAMBDA1:
    Type: AWS::Serverless::Function
    Properties:
      Handler: samdemoLambda1.lambda_handler
      Runtime: python2.7
      CodeUri: ./src/foo
      Events:
                HelloWorld:
                    Type: Api 
                    Properties:
                        Path: /hello
                        Method: get

  SAMDEMOLAMBDA2:
    Type: AWS::Serverless::Function
    Properties:
      Handler: samdemoLambda2.lambda_handler
      Runtime: python2.7
      CodeUri: ./src/blah
      CodeUri: ./src/util

How could i import this common util.py in lambda 2

divyanayan awasthi
  • 890
  • 1
  • 8
  • 33

0 Answers0