To start building SAM-based applications, we must first install the SAM CLI, install the AWS credentials, and initialize a simple SAM application.
Install sam
CLI.
Setup AWS credentials.
If you have already installed AWS credentials from previous posts, you can skip this step.
Open IAM console
Click User on the left menu.
Click Create user button.
At Step 1: Specify user details page.
sam-admin
.At Step 2: Set permissions page.
At Step 3: Review and create page.
At Step 4: Review and create page, click Return to users list.
At sam-admin page.
At Step 1: Access key best practices & alternatives.
At Step 2: Set description tag.
At Step 3: Retrieve access keys.
Run the command using the terminal on your device.
aws configure
Then, create a sample sam
project.
Run the below commands at the directory where you want to deploy the application.
#Step 1 - Download a sample application
sam init
Then select the options:
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.