A Beginner’s Guide to Configuring AWS CLI in Your Local System
The AWS Command Line Interface (CLI) provides a powerful way to interact with AWS services directly from your terminal or command prompt. Setting up AWS CLI on your local system enables you to manage AWS resources, automate tasks, and integrate AWS services into your scripts and applications. In this guide, we’ll walk you through the process of configuring AWS CLI step by step.
Step 1: Install AWS CLI
- Check Python Installation: Ensure Python is installed on your system by opening a terminal or command prompt and typing:
python --version
If Python is not installed, download and install it from the official Python website: python.org.
2. Install AWS CLI: Once Python is installed, you can install AWS CLI using pip, the Python package manager. Run the following command in your terminal or command prompt:
pip install awscli
Step 1: Install AWS CLI for Windows
- Access the AWS CLI Installation Page: Open your web browser and navigate to the AWS CLI Installation Page at https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
- Navigate to the section titled “AWS CLI Installation and Update Instructions,” then select the “Windows” subsection. You can directly access the installation file by clicking on the following link: AWS CLI Installation for Windows. Once the download begins, proceed to follow the provided instructions to install the AWS CLI on your system.
- Alternatively, you can run the
msiexec
command to run the MSI installer.
C:\> msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi
For various parameters that can be used msiexec
, see msiexec on the Microsoft Docs website. For example, you can use the /qn
flag for a silent installation.
C:\> msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi /qn
Step 2: Verify Installation
- Verify AWS CLI Installation: After installation, confirm that AWS CLI is installed correctly by typing in Command Prompt/Terminal:
aws
If you see the below information, then your installation is successful.
aws --version
This command should display the installed version of AWS CLI.
Step 3: Configure AWS CLI
- Run Configuration Wizard: To configure AWS CLI with your AWS credentials and default settings, run:
aws configure
- Enter Access Key ID and Secret Access Key: You’ll be prompted to enter your AWS Access Key ID and Secret Access Key. These credentials can be obtained from the AWS Management Console under IAM (Identity and Access Management).
- Set Default Region: Enter the default region that you want to use for AWS services. You can leave this blank to use the default region configured in your AWS profile.
- Set Default Output Format: Choose the default output format for AWS CLI commands. Options include JSON, text, or table format.
Step 4: Test Configuration
- Test Configuration: To verify that AWS CLI is configured correctly, try running a simple command, such as:
aws s3 ls
This command lists all the S3 buckets in your AWS account. If the command executes without errors and displays the expected output, your configuration is successful.
Step 5: Additional Configuration (Optional)
- Custom Profiles: You can create and manage multiple profiles with different AWS credentials and settings by editing the AWS CLI configuration file located at
~/.aws/config
on Unix-like systems or%UserProfile%\.aws\config
on Windows. - Advanced Configuration: Explore advanced configuration options such as specifying output formats, setting up AWS credentials files, and configuring AWS CLI plugins.
Congratulations! You’ve successfully configured AWS CLI on your local system. You can now start using AWS CLI to manage AWS resources, automate tasks, and streamline your AWS workflow directly from your terminal or command prompt. Happy coding!