0

Hello here is my project structure: -AppName -Common -common.js //Global module which i'm using in all functions -Func1 -index.js -Func2 -index.js -template.yaml And here is template.yaml content:

AWSTemplateFormatVersion: '2010-09-09' Transform: 'AWS::Serverless-2016-10-31' Description: An AWS Serverless Specification template describing your function. Resources: Func1: Type: 'AWS::Serverless::Function' Properties: Handler: Func1/index.handler Runtime: nodejs6.10 MemorySize: 512 Timeout: 10 Func2: Type: 'AWS::Serverless::Function' Properties: Handler: Func2/index.handler Runtime: nodejs6.10 MemorySize: 512 Timeout: 10

When i deploy for example Func2, result package contain all folders inside application, instead only Func2. Is it possible to configure through yaml file, what files will included in result package? For example if i deploy Func2 i want to see in package next:

-Common -common.js -Func2 -index.js

Yevhen
  • 791
  • 9
  • 24

1 Answers1

0

You can use the CodeUri key in SAM and point it to the folder where your code lies for that one function.

So for this function, you'd want to do:

  Func2:
    Type: 'AWS::Serverless::Function'
    Properties:
      CodeUri: Func2
      Handler: index.handler
      Runtime: nodejs6.10
      MemorySize: 512
      Timeout: 10
Brady Dowling
  • 4,920
  • 3
  • 32
  • 62
  • Thank's for your answer. I think in this case i will lost connection with Common folder which is also needed for each function – Yevhen Feb 28 '18 at 10:30