The AWS Command Line Interface (CLI) allows you to manage your AWS services directly from the command line. To use it, you need to configure the AWS CLI with your IAM credentials. This includes setting up an IAM user with programmatic access permissions.
The configuration process is the same across all major platforms, including Windows, Linux, and macOS. By default, the AWS CLI creates a profile named default, but you can also configure it for multiple profiles or accounts.
This setup involves entering your Access Key ID, Secret Access Key, default region, and output format. Proper configuration ensures the AWS CLI is ready to execute commands on your AWS resources.
Steps to configure AWS CLI tool on Linux, macOS and Windows:
- Create an IAM user with programmatic access permissions in your AWS account.
- Obtain the Access Key ID and Secret Access Key for this IAM user.
- Open the command line interface on your system.
- Run the aws configure command.
$ aws configure
- Enter the AWS Access Key ID when prompted.
AWS Access Key ID [None]: AKIAJ3TE4LUDC4I6SQDQ
- Enter the AWS Secret Access Key when prompted.
AWS Secret Access Key [None]: Ibt05WpUQ33Wqkig8HijqDeZd0wyr+hHJoQy/RMz
- Enter the default region name for your AWS resources.
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 - Choose the 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.
- Verify the configuration by checking the created files in the ~/.aws directory.
$ ls .aws/ config credentials
- The credentials file will store the AWS Access Key ID and AWS Secret Access Key.
$ cat .aws/credentials [default] aws_access_key_id = AKIAJ3TE4LUDC4I6SQDQ aws_secret_access_key = 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
- The config file will store the default region and output format.
$ 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
- Use the aws command to execute actions on your AWS account.
$ aws s3 ls 2018-12-29 13:58:51 simplified-guide
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Comment anonymously. Login not required.