The AWS Command Line Interface (AWS CLI) is a powerful tool that provides administrators and developers with a command-line interface to interact with various AWS services. It offers a convenient and scriptable way to manage AWS resources, automate tasks, and integrate AWS functionality into workflows. The AWS CLI is a command-line tool for interacting with AWS services.

Features of AWS CLI:

Resource Management:

  • Creation and Deletion: Administrators can create and delete AWS resources such as EC2 instances, S3 buckets, and databases using simple commands. This makes resource management more efficient
  • Configuration Management: Developers can use the AWS CLI to configure and manage AWS services, including setting up networking, security groups, and access policies

Scripting and Automation:

  • Scripting: Developers and administrators can write scripts to automate repetitive tasks using the AWS CLI. This enables the creation of custom automation workflows and the integration of AWS functionality into existing scripts and processes
  • Integration with Other Tools: The AWS CLI can be easily integrated into various scripting and automation tools, making it a versatile tool for building complex automation pipelines

Access and Security:

  • IAM Operations: Administrators can manage Identity and Access Management (IAM) entities, such as users, roles, and policies, using the AWS CLI. This is crucial for controlling access to AWS resources
  • Security Group and VPC Configuration: Developers and administrators can configure security groups, Virtual Private Clouds (VPCs), and other networking components to ensure a secure environment for their applications

Monitoring and Logging:

  • CloudWatch Operations: Users can interact with CloudWatch, AWS’s monitoring service, to retrieve metrics, set up alarms, and analyze logs. This helps in monitoring the health and performance of AWS resources
  • Logging and Auditing: Administrators can use the AWS CLI to access logs and audit trails for various AWS services, helping in troubleshooting and compliance

Data Management:

  • S3 Operations: Developers and administrators can manage data stored in Amazon S3 by uploading, downloading, and deleting objects. This is essential for data storage and retrieval tasks
  • Database Operations: The AWS CLI provides commands for managing databases, such as creating snapshots, restoring backups, and modifying database configurations

Infrastructure as Code (IaC):

  • Integration with IaC Tools: The AWS CLI integrates seamlessly with Infrastructure as Code (IaC) tools like AWS CloudFormation and Terraform. This allows developers to define and deploy infrastructure using code
  • Template Deployment: Administrators can use the AWS CLI to deploy AWS CloudFormation templates, enabling the provisioning of complex infrastructure stacks

Cross-Account and Cross-Region Operations:

  • Cross-Account Operations: Administrators can manage resources across multiple AWS accounts using the AWS CLI. This is useful for scenarios where resources need to be shared or managed centrally
  • Cross-Region Operations: Users can perform operations across different AWS regions, allowing for redundancy, disaster recovery, and optimizing resource deployment based on geographical requirements

Cost Management:

  • Cost Explorer: Administrators can utilize the AWS CLI to retrieve cost and usage information from AWS Cost Explorer. This helps in monitoring and optimizing AWS costs

How to install and configure AWS CLI:

To install the AWS Command Line Interface (AWS CLI) on CentOS, you can use the following steps.

Protect Your Data with BDRSuite

Cost-Effective Backup Solution for VMs, Servers, Endpoints, Cloud VMs & SaaS applications. Supports On-Premise, Remote, Hybrid and Cloud Backup, including Disaster Recovery, Ransomware Defense & more!

Step 1: Open a terminal on your CentOS machine. My CentOS version in CentOS 9 which is forked from RHEL 9

[root@centos9 ~]# cat /etc/redhat-release
CentOS Stream release 9

Step 2: Update Package Manager. Ensure that your package manager is up-to-date by running the following command:

Download Banner

[root@centos9 ~]# dnf update
Last metadata expiration check: 0:43:42 ago on Sat 04 Nov 2023 08:17:39 PM UTC.
Dependencies resolved.

Package Architecture Version Repository Size
Installing:
kernel x86_64 5.14.0-383.el9 baseos 5.5 M
Upgrading:
NetworkManager x86_64 1:1.45.5-1.el9 baseos 2.3 M
NetworkManager-initscripts-updown noarch 1:1.45.5-1.el9 baseos 24 k
NetworkManager-libnm x86_64 1:1.45.5-1.el9 baseos 1.8 M
NetworkManager-team x86_64 1:1.45.5-1.el9 baseos 43 k
NetworkManager-tui x86_64 1:1.45.5-1.el9 baseos 246 k

Step 3: Download the AWS CLI using the following command and unzip it.

[root@centos9 ~]# curl “https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip” -o “awscliv2.zip”
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 57.1M 100 57.1M 0 0 732k 0 0:01:19 0:01:19 –:–:– 791k
[root@centos9 ~]# unzip awscliv2.zip
[root@centos9 temp]# ls -lrt
total 58528
drwxr-xr-x. 3 root root 78 Dec 22 17:59 aws
-rw-r–r–. 1 root root 59930333 Dec 23 15:50 awscliv2.zip
[root@centos9 temp]#

Step 4: Install the AWS CLI using the following command:

[root@centos9 temp]# ./aws/install
You can now run: /usr/local/bin/aws –version
[root@centos9 temp]#

Step 5: Verify Installation – After the installation is complete, you can verify the installation by checking the AWS CLI version:

[root@centos9 temp]# aws –version
aws-cli/2.15.4 Python/3.11.6 Linux/5.14.0-391.el9.x86_64 exe/x86_64.centos.9 prompt/off
[root@centos9 temp]#

This command should display the installed AWS CLI version.

Step 6: Configure AWS CLI – To use the AWS CLI, you need to configure it with your AWS credentials. Run the following command:

[root@centos9 temp]# aws configure
AWS Access Key ID [None]: XXXXXXXXXVT
AWS Secret Access Key [None]: XXXXXXXXXXXXXXXXXXXoFJyXXXXXCjXX
Default region name [None]: us-east-2
Default output format [None]:
[root@centos9 temp]#

This command prompts you to enter your AWS Access Key ID, Secret Access Key, default region, and default output format. You can obtain your Access Key ID and Secret Access Key from the AWS Management Console under IAM (Identity and Access Management) settings.

Once you have entered the required information, the AWS CLI is configured and ready to use.

Step 7: Test AWS CLI
You can test the AWS CLI by running a simple command, such as:

[root@centos9 temp]# aws s3 ls
2022-07-31 13:27:04 bdrsuite-repo
[root@centos9 temp]#

This command lists the contents of your S3 buckets. If you have the necessary permissions, it should display a list of your S3 buckets.

That’s it! You have successfully installed and configured the AWS CLI on CentOS. You can now use it to interact with various AWS services from the command line.

Conclusion:

The AWS CLI is a versatile and essential tool for administrators and developers working with AWS. Its capabilities extend to a wide range of AWS services, providing a unified interface for managing and interacting with cloud resources. It complements other AWS management tools and services, making it an integral part of the AWS ecosystem.

Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

Rate this post