Sign in through the AWS Command Line Interface - AWS Sign-In

Sign in through the AWS Command Line Interface

You must establish how the AWS CLI authenticates with AWS. Choose the method that best fits your workflow and security requirements.

Login with console credentials (Recommended)

This authentication method lets you use your console credentials with the AWS CLI, making it easy to get started with AWS programmatically within minutes of account set up. You can get temporary credentials that work seamlessly across local development tools like the AWS CLI, AWS SDKs and AWS Tools for PowerShell.

Prerequisites

To login with console credentials
  1. Run the following command to start the browser-based authentication process:

    $ aws login

    The aws login command supports several optional parameters:

    • aws login --remote - For cross-device authentication when your device doesn't support a browser

    • aws login --profile profile-name - To authenticate with a specific profile

    • aws login --region region - To authenticate in a specific region

  2. Follow the prompts in your terminal. The command will automatically open your default browser and guide you through the authentication process. After successful authentication, your AWS CLI session will be valid for up to 12 hours.

  3. To end your session, use:

    $ aws logout

If you are accessing AWS services programmatically by using AWS Tools for PowerShell, please see Authenticating the AWS Tools for PowerShell with AWS. If you are using AWS SDKs, please see Authentication and access using AWS SDKs and tools.

Login with IAM Identity Center credentials

The AWS access portal makes it easy for IAM Identity Center users to select an AWS account and get temporary security credentials for the AWS CLI. For more information about how to get these credentials, see Region availability for AWS Builder ID. You can also configure the AWS CLI directly to authenticate users with IAM Identity Center.

To login with IAM Identity Center credentials
  1. Check that you've completed the Prerequisites.

  2. If you're signing in for the first time, configure your profile with the aws configure sso wizard.

  3. After you configure your profile, run the following command, then follow the prompts in your terminal:

    $ aws sso login --profile my-profile

Additional information

If you want more information about signing-in using the command line, refer to the following resources.