Ultimate AWS CLI: 10 Useful Commands Every Cloud Beginner Should Learn

AWS CLI

Amazon Web Services (AWS) provides many cloud services for computing, storage, databases, networking, security, and application development. While the AWS Management Console provides a graphical interface, developers and cloud professionals often use the AWS Command Line Interface to manage AWS resources from a terminal. AWS allows users to interact with AWS services by entering commands instead of navigating through multiple console pages.

It is useful for automation, troubleshooting, administration, and cloud learning. For beginners, learning a few basic AWS CLI commands is a good way to understand how AWS services work. In this guide, we will explore 10 useful AWS CLI commands, including commands for checking your CLI installation, identifying your AWS account, viewing EC2 instances, and managing S3 resources.

Prerequisites

Before using AWS CLI commands, you should have:

  • An active AWS account
  • An EC2 Linux instance or another environment where AWS is available
  • An IAM role or credentials with appropriate permissions
  • Basic knowledge of Linux terminal commands
  • An S3 bucket for storage-related practice

For an EC2 instance, attaching an IAM role is a recommended approach because it allows the instance to obtain temporary AWS credentials without storing access keys directly on the server.

1. Check the AWs CLI Version

The first command beginners should learn is:
aws –version
This command displays the installed AWS CLI version and confirms that the CLI is available in the terminal.

A typical result may look like:
aws-cli/2.x.x Python/3.x Linux/…
If the command returns a version number, AWS CLI is installed correctly.
Why it is useful: It is a quick way to verify the AWS CLI installation before running other commands.

2. Check Your AWS Identity

After confirming that AWS CLI is installed, you should check whether it can access your AWS account.
Run:
aws sts get-caller-identity
The command may return information similar to:

{
“UserId”: “…”,
“Account”: “…”,
“Arn
“: “…”
}

This command uses AWS Security Token Service (STS) to identify the IAM user or role associated with your current AWS CLI session.
Why it is useful: It helps confirm that your CLI authentication is working and that you are using the expected AWS account or IAM role.

3. View EC2 Instance Information

Amazon EC2 provides virtual servers in the AWS cloud. You can use AWS to retrieve information about EC2 instances.
Run:
aws ec2 describe-instances
This command returns detailed information about EC2 instances, including instance IDs, states, networking information, and configuration details.

Because the output can be very long, beginners can use a query to display only the instance ID:
aws ec2 describe-instances –query ‘Reservations[].Instances[].InstanceId’
The output may look like:
[
“i-xxxxxxxxxxxxxxxxx”
]
Why it is useful: It allows you to view EC2 information without opening the AWS Management Console.

4. Check the EC2 Instance State

After finding the instance ID, you can check whether the instance is running.
Use:
aws ec2 describe-instances –no-cli-pager –query ‘Reservations[].Instances[].State.Name’

If the instance is running, the result should be similar to:
[
“running”
]
Other possible states include stopped, stopping, pending, and terminated.
The –no-cli-pager option prevents AWS from opening the output in a scrolling viewer.
Why it is useful: You can quickly check the status of an EC2 server from the terminal.

5. List S3 Buckets

Amazon S3 is an object storage service used for storing files and other data.
To view the S3 buckets available to your AWS account, run:
aws s3 ls –no-cli-pager

You may see output similar to:
2026-09-01 10:20:30 my-example-bucket
If you don’t have any buckets, the command may return no results.
Why it is useful: It provides a quick way to check your S3 buckets from the command line.

6. Create an S3 Bucket

AWS can also create an S3 bucket.
Use:
aws s3 mb s3://YOUR-UNIQUE-BUCKET-NAME –region ap-south-1 –no-cli-pager

For example:
aws s3 mb s3://aws-cli-practice-2026-12345 –region ap-south-1 –no-cli-pager
The bucket name must be globally unique. Therefore, you should create your own name instead of copying the example.
A successful command may return:
make_bucket: aws-cli-practice-2026-12345
Why it is useful: It demonstrates how AWS CLI can create cloud storage without using the AWS console.

7. Upload a File to S3

The aws s3 cp command is used to copy files between your local environment and an S3 bucket.
First, create a small test file:
echo “Hello AWS CLI” > test.txt
Then upload it:
aws s3 cp test.txt s3://YOUR-BUCKET-NAME/

A successful upload may display:
upload: ./test.txt to s3://YOUR-BUCKET-NAME/test.txt
You can verify the uploaded file with:
aws s3 ls s3://YOUR-BUCKET-NAME/ –no-cli-pager
Why it is useful: This command demonstrates one of the most common S3 operations—uploading files.

8. Delete an S3 Object

After testing the upload, you can remove the test file from your bucket.
Run:
aws s3 rm s3://YOUR-BUCKET-NAME/test.txt
You should receive an output similar to:
delete: s3://YOUR-BUCKET-NAME/test.txt
Why it is useful: It teaches beginners how to manage objects stored in S3 using the command line.

9. Check Detailed S3 Bucket Contents

You can check the contents of a specific S3 bucket using:
aws s3 ls s3://YOUR-BUCKET-NAME/ –no-cli-pager
If the bucket contains files, their details will be displayed. If it is empty, no objects will be listed.
You can also use:
aws s3 ls s3://YOUR-BUCKET-NAME/ –recursive –no-cli-pager
The –recursive option allows AWS CLI to list objects inside folders or prefixes within the bucket.
Why it is useful: It helps users verify whether files have been successfully uploaded to S3.

10. Check EC2 Instances Status Information

Another useful read-only command is:
aws ec2 describe-instance-status –no-cli-pager
This command provides information about the status checks of EC2 instances.
EC2 performs status checks to identify problems affecting the instance or its underlying infrastructure.

For a specific instance, you can use:
aws ec2 describe-instance-status –instance-ids YOUR-INSTANCE-ID –no-cli-pager
Why it is useful: It can help administrators check whether an EC2 instance has passed its system and instance status checks.

Common AWS CLI Problems

Beginners may encounter several errors while using AWS.

Unable to locate credentials
This error means AWS CLI cannot find credentials. When using an EC2 instance, attaching an appropriate IAM role can solve this problem.

UnauthorizedOperation
This means the IAM identity does not have permission to perform the requested action. Check the IAM role or policy attached to your environment.

Invalid instance ID
Make sure you use the actual EC2 instance ID rather than an example such as i-0123456789abcdef0.

Region-related errors
Some AWS resources are region-specific. Make sure you are working in the correct AWS region, such as ap-south-1 for the Mumbai region.

AWS CLI Best Practices

When learning AWS CLI, follow these practices:

  1. Use IAM roles whenever possible instead of storing long-term access keys on EC2 instances.
  2. Give IAM identities only the permissions they actually need.
  3. Double-check resource names before running commands.
  4. Be especially careful with commands that delete or modify resources.
  5. Use a test environment when practicing.
  6. Use –query to simplify large outputs.
  7. Use –no-cli-pager when you want command results displayed directly in the terminal.

Conclusion

AWS CLI is a powerful tool for managing AWS services directly from the command line. Beginners can start with simple commands such as aws –version, aws sts get-caller-identity, and aws s3 ls before moving to resource-management commands.
The commands covered in this guide provide a practical introduction to EC2 and S3 management using AWS CLI. By practicing them in a safe test environment, beginners can develop useful cloud administration skills and become more comfortable working with AWS.

AWS CLI also becomes increasingly valuable when working with automation, scripts, DevOps tools, and cloud infrastructure. Learning these fundamental commands is therefore a useful first step toward more advanced AWS and cloud computing skills.

FAQs

  1. What is AWS CLI?
    CLI (Command Line Interface) is a tool that allows users to manage AWS services and resources by running commands from a terminal instead of using the AWS Management Console.
  2. Is AWS CLI free to use?
    Yes. AWS CLI itself is available at no additional charge. However, the AWS resources you manage through it, such as EC2 instances and S3 storage, may incur charges depending on your usage.
  3. What is the aws sts get-caller-identity command used for?
    It identifies the AWS account and IAM user or role being used by AWS CLI. It is useful for verifying that your AWS credentials or IAM role are configured correctly.
  4. Can AWS CLI manage Amazon S3 buckets?
    Yes. AWS provides several S3 commands for creating buckets, listing objects, uploading files, downloading files, and deleting objects.
  5. Why do I get an “UnauthorizedOperation” error in AWS CLI?
    An UnauthorizedOperation error usually means the IAM user or role does not have permission to perform the requested action. You need to check the IAM policies attached to your identity and add the required permissions.

Discover more from Root Learning

Subscribe to get the latest posts sent to your email.

Leave a Reply

Your email address will not be published. Required fields are marked *