To start building SAM-based applications, we must first install the SAM CLI, install the AWS credentials, and initialize a simple SAM application.
brew tap aws/tap
brew install aws-sam-cli
sam --version
pip install aws-sam-cli
sam --version
sam --version
You can refer to: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html
Open IAM console
Click User on the left menu.
Click Create user button
Enter user name, such as: AdminSAMUser
Check option Provide user access to the AWS Management Console
Select I want to create an IAM user
Select Custom password, then enter your password
Uncheck the User must create a new password at next sign-in
Click Next
Select Attach existing policies directly
Select AdministratorAccess policy to the user has full access to the services
Click Next
Click Next: Review
Review configuration, and click Create user
Click Return to users list.
Click Create access key
For Use case, select Command Line Interface(CLI)
Check to Confirmation
Click Next
Click Create access key
Click Download .csv file
Run the command using the terminal on your device
aws configure
Enter the information corresponding to the columns in the credential file you downloaded
#Step 1 - Download a sample application
sam init
Which template source would you like to use?
1 - AWS Quick Start Templates
2 - Custom Template Location
Choice: 1
Choose an AWS Quick Start application template
1 - Hello World Example
2 - Multi-step workflow
3 - Serverless API
4 - Scheduled task
5 - Standalone function
6 - Data processing
7 - Infrastructure event management
8 - Machine Learning
Template: 1
Use the most popular runtime and package type? (Python and zip) [y/N]: y
Would you like to enable X-Ray tracing on the function(s) in your application? [y/N]: n
Project name [sam-app]: fcj-book-shop
You have created a sample SAM project. Next , we will edit that project according to our application architecture.