Initialize project

AWS SAM provides you with a command line tool, the AWS SAM CLI, that makes it easy for you to create and manage serverless applications. It particularly makes easy the scaffolding of a new project, as it creates the initial skeleton of a hello world application, so you can use it as a baseline and continue building your project from there.

Run the following command to scaffold a new project:

sam init

It will prompt for project configuration parameters:

Type 1 to select AWS Quick Start Templates

samInit

Type 1 to select Zip as the package type

samInit

Choose nodejs12.x for runtime

samInit

Leave default sam-app for project name

samInit

Type 1 to select the Hello World Example

samInit

This command supports cookiecutter templates, so you could write your own custom scaffolding templates and specify them using the location flag, For example: sam init –location git+ssh://git@github.com/aws-samples/cookiecutter-aws-sam-python.git.

Project should now be initialized

You should see a new folder sam-app created with a basic Hello World scaffolding. samInit

If you are interested in learning more about initializing SAM projects, you can find the full reference for the sam init command in the SAM CLI reference.