Amazon SAM prerequisites
Complete the following prerequisites before installing and using the Amazon Serverless Application Model Command Line Interface (Amazon SAM CLI).
To use the Amazon SAM CLI, you need the following:
- 
			An Amazon account, Amazon Identity and Access Management (IAM) credentials, and an IAM access key pair. 
- 
			The Amazon Command Line Interface (Amazon CLI) to configure Amazon credentials. 
Topics
Step 1: Sign up for an Amazon account
If you do not have an Amazon Web Services account, use the following procedure to create one.
To sign up for Amazon Web Services
- Open http://www.amazonaws.cn/ - and choose Sign Up. 
- Follow the on-screen instructions. 
Step 2: Create an IAM user account
Secure IAM users
After you sign up for an Amazon Web Services account, safeguard your administrative user by turning on multi-factor authentication (MFA). For instructions, see Enable a virtual MFA device for an IAM user (console) in the IAM User Guide.
To give other users access to your Amazon Web Services account resources, create IAM users. To secure your IAM users, turn on MFA and only give the IAM users the permissions needed to perform their tasks.
For more information about creating and securing IAM users, see the following topics in the IAM User Guide:
Step 3: Create an access key ID and secret access key
For CLI access, you need an access key ID and a secret access key. Use temporary credentials instead of long-term access keys when possible. Temporary credentials include an access key ID, a secret access key, and a security token that indicates when the credentials expire. For more information, see Using temporary credentials with Amazon resources in the IAM User Guide.
Users need programmatic access if they want to interact with Amazon outside of the Amazon Web Services Management Console. The Amazon APIs and the Amazon Command Line Interface require access keys. Whenever possible, create temporary credentials that consist of an access key ID, a secret access key, and a security token that indicates when the credentials expire.
To grant users programmatic access, choose one of the following options.
| Which user needs programmatic access? | To | By | 
|---|---|---|
| IAM | Use short-term credentials to sign programmatic requests to the Amazon CLI or Amazon APIs (directly or by using the Amazon SDKs). | Following the instructions in Using temporary credentials with Amazon resources in the IAM User Guide. | 
| IAM | (Not recommended)Use long-term credentials to sign programmatic requests to the Amazon CLI or Amazon APIs (directly or by using the Amazon SDKs). | Following the instructions in Managing access keys for IAM users in the IAM User Guide. | 
Step 4: Install the Amazon CLI
The Amazon CLI is an open source tool that enables you to interact with Amazon Web Services services using commands in your command-line shell. The Amazon SAM CLI requires the Amazon CLI for activities such as configuring credentials. To learn more about the Amazon CLI, see What is the Amazon Command Line Interface? in the Amazon Command Line Interface User Guide.
To install the Amazon CLI, see Installing or updating the latest version of the Amazon CLI in the Amazon Command Line Interface User Guide.
Step 5: Use the Amazon CLI to configure Amazon credentials
To configure credentials with IAM Identity Center
- To configure credentials with IAM Identity Center, see Configure your profile with the Amazon configure sso wizard. 
To configure credentials with the Amazon CLI
- 
				Run the aws configurecommand from the command line.
- 
				Configure the following. Select each link to learn more: The following example shows sample values. $aws configureAWS Access Key ID [None]:AKIAIOSFODNN7EXAMPLEwJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEYus-west-2json
The Amazon CLI stores this information in a profile (a collection of settings) named 
			default in the credentials and config files. These files are
			located in the .aws file in your home directory. By default, the information in this profile is used 
			when you run an Amazon CLI command that doesn't explicitly specify a profile to use. For more information on the 
			credentials file, see 
				Configuration and credential file settings in the Amazon Command Line Interface User Guide.
For more information on configuring credentials, such as using an existing configuration and credentials file, see Quick setup in the Amazon Command Line Interface User Guide.
Step 6: (Optional) Install Amazon Toolkit for VS Code
For developers who prefer an integrated development environment, the Amazon Toolkit for VS Code provides powerful features for serverless development including visual debugging, CodeLens integration, and streamlined deployment workflows.
Prerequisites for VS Code development
- Visual Studio Code (version 1.73.0 or a later version) installed on your system 
- YAML language support extension for VS Code 
To install the Amazon Toolkit for VS Code
- Open Visual Studio Code 
- Open the Extensions view (Ctrl+Shift+X or Cmd+Shift+X) 
- Search for "Amazon Toolkit" 
- Install the "Amazon Toolkit" extension by Amazon Web Services 
- Install the "YAML" extension by Red Hat (required for SAM template CodeLens features) 
Benefits of using VS Code with Amazon SAM
- Visual debugging: Set breakpoints and step through your Lambda functions locally 
- CodeLens integration: Build, deploy, and invoke functions directly from your SAM template 
- Integrated terminal: Access Amazon SAM Amazon CLI commands without leaving your editor 
- Template validation: Real-time validation and IntelliSense for SAM templates 
For information about configuring your Amazon credentials in VS Code, see 
				Setting up credentials
Next steps
- 
				You are now ready to install the Amazon SAM CLI and start using Amazon SAM. To install the Amazon SAM CLI, see Install the Amazon SAM CLI. 
- 
				To set up Visual Studio Code for serverless development, see Setting up the Amazon Toolkit for VS Code .