This is a sample serverless app for Testing Serverless Applications course on Senzon Homeschool.
This project has the following folder structure:
.
├── LICENSE
├── README.md # This file
├── WHO-COVID-19-global-data.csv # Sample data
├── build # Build folder
│ └── parse-covid-csv # Each function has its own folder
│ ├── lambda.js # Function source code
│ └── lambda.js.map # Source maps
├── jest.config.js # Jest configuration for testing
├── package-lock.json
├── package.json
├── samconfig.toml # AWS SAM config file, generated by SAM
├── src # Source code for all functions
│ └── parse-covid-csv # Fuction source code
│ ├── events # Events for local testing
│ │ ├── context.ts
│ │ └── event.json
│ └── lambda.ts # Function source code
├── template.yaml # Main CloudFormation file
├── tsconfig.json
├── webpack.config.js # Webpack config
└── yarn.lock
To use this template, make sure you have the following prerequisites:
- AWS profile
- AWS SAM installed and configured
- Node.js version 8 or more (version 12 is recommended)
To build TypeScript, run the npm install
or yarn install
command to install the dependencies, then run the following command:
npm run build
If you want to build a project and run the webpack bundle analyzer, run the following command:
npm run build-analyze
To deploy the project, run the following command:
sam deploy --guided
This will run an interactive deployment process and ask you for the Amazon S3 bucket name. Amazon S3 bucket must have unique names, so try to be creative. If the deployment fails, you'll need to go to the AWS CloudFormation and delete the stack manually.
After the deployment is done, SAM will save your configuration to the samconfig.toml
file.
NOTE: The samconfig.toml
file is on git ignore list.
See the initial deployment flow video here.
To deploy the app again, build TypeScript and simply run the following command:
sam deploy
This section will be added tomorrow.
MIT, see LICENSE.