6

I have a new project that requires a relatively small amount of services, maybe 10 or less (and therefore it is not economical to place each in a separate project repository). Each service will be defined as an AWS::Serverless::Function via SAM Template. My question is: what is the recommended way to organize or structure such a project?

Currently the structure is:

|- src
    |- lambdas
        |- service-one
            |- stuff
            |- package.json
        |- service-two
            |- stuff
            |- package.json
    |- other-stuff
|- test
|- package.json

Is there a way to avoid having each lambda act as its own sub-project with unique package.json and etc?

PythonJin
  • 4,034
  • 4
  • 32
  • 40
Kwhitejr
  • 2,206
  • 5
  • 29
  • 49
  • I think you dont need separate package.json for each project, because all this functions will be deployed with "sam package / sam deploy" in one request to asw cloudformation. If you find out new info about best practices for project structure, please, share it in comment. – GFB Jul 16 '19 at 13:30

1 Answers1

0

I have designed the structure of my project like below

ProjectName
├── dependencies
│   └── package-pandas-requests.zip
├── deploy.sh
├── infrastructure
│   ├── packaged.yaml
│   └── template.yaml
└── src
    └── lambdas
        ├── lambdafunction1
        │   └── app.py
        ├── lambdafunction2
        │   └── app.py
        ├── lambdafunction3
        │   └── app.py

dependencies are layers package infrastructure for yaml files of SAM framework Hope this will clear your doubt.

Fronto
  • 374
  • 2
  • 12