Creating an AWS SAM Project is simple, it should only take about 5 minutes.
Project Creation
Prerequisites
- AWS account created
- AWS SAM CLI installed
- AWS credential configured
Initialize a SAM project as shown below. We use nodejs and typescript for script function.
Steps to Initialize a SAM Project
Open a terminal and run the following command:
1> sam init
Follow the prompts to configure your project:
1Which template source would you like to use? 2Choice: 1 3 4Choose an AWS Quick Start application template 5Template: 1 6 7Use the most popular runtime and package type? (Python and zip) [y/N]: N 8 9Which runtime would you like to use? 10Runtime: 12 11 12What package type would you like to use? 13Package type: 1 14 15Select your starter template 16Template: 2 17 18Project name [sam-app]: sam-???
Once completed, your AWS SAM project will be initialized in a folder matching the name you provided.
What’s Next?
Your project folder will include all the files necessary to start building your serverless application. Open the folder in your preferred code editor and explore the following:
template.yaml
AWS SAM template defining your application's resources.hello-world
folder (or equivalent): Contains the TypeScript code for your Lambda function- Configuration files for dependencies and build tools like
package.json
.
From here, you can begin coding, deploying, and testing your AWS serverless application.