AWS Command Line Interface (CLI) tools allow you to manage your AWS services from the command line. For it to work, you'll need to have an IAM user with appropriate permission configured for programmatic access and configure the AWS CLI tools on your machines.

The following configuration method of AWS CLI is applicable for all the platforms such as Windows, Linux, or any other UNIX-based operating systems, including macOS. It creates a single profile named default by default, though you can also configure it for multiple profiles or accounts.

Step-by-step video guide:

Steps to configure AWS CLI tool on Linux, macOS and Windows:

  1. Create a user with programmatic access and appropriate permissions from IAM on your AWS account.
  2. Get Access key ID and Secret access key for the user when creating the IAM user.
  3. Run aws command in the command line with configure as argument.
    $ aws configure
  4. Enter AWS Access Key ID of the user.
    AWS Access Key ID [None]: AKIAJ3TE4LUDC4I6SQDQ
  5. Enter AWS Secret Access Key of the user.
    AWS Secret Access Key [None]: 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
  6. Enter Default region name to use the account.
    Default region name [None]:

    You could leave the field blank. The list of available regions are available in AWS online documentation.
    Related: AWS Regions and Endpoints

  7. Enter Default output format.
    Default output format [None]:

    You could leave the field blank. Default value is json but you can also set it to text or table.

  8. List generated files in the ~/.aws directory.
    $ ls .aws/
    config  credentials
  9. AWS Access Key ID and AWS Secret Access Key stored in ~/.aws/credentials
    $ cat .aws/credentials
    [default]
    aws_access_key_id = AKIAJ3TE4LUDC4I6SQDQ
    aws_secret_access_key = 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
  10. Default region name and Default output format are stored in ~/.aws/config.
    $ cat .aws/config
    [default]

    You could manually add the configuration later in the following format:

    default_region_name=your_preferred_region
    default_output_format=your_preferred_format
  11. You can now run the aws command to execute upon your AWS account wherever you have the correct permission for.
    $ aws s3 ls
    2018-12-29 13:58:51 simplified-guide
Discuss the article:

Comment anonymously. Login not required.