Search code examples
amazon-web-servicesaws-cloudformationaws-sam-cliaws-sam

How to ignore redundant files while deploying lambda in SAM project


I have SAM project structure like this:

sam-app/
   ├── README.md
   ├── events/
   │   └── event.json
   ├── myTestLambda/
   │   ├── app.py            
   │   └── requirements.txt  
   ├── template.yaml         
   └── tests/
       └── unit/
           ├── __init__.py
           └── test_handler.py

After publishing in lambda storage I have the same structure with all files from project instead only one lambda function file. How to ignore project files?


Solution

  • Actually we should specify path to file in CodeURI property in template file. For example:

    "CodeUri": "./myTestLambda" 
    

    in JSON format. That is solve this problem.