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 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 the Amazon CLI
-
Run the
aws configure
command from the command line. -
Configure the following. Select each link to learn more:
The following example shows sample values.
$
aws configure
AWS Access Key ID [None]:
AWS Secret Access Key [None]:AKIAIOSFODNN7EXAMPLE
Default region name [None]:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default output format [None]:us-west-2
json
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.
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.