Master AWS CLI for Streamlined Cloud Management
What is AWS CLI?
The AWS Command Line Interface (CLI) is a powerful tool that allows developers, DevOps engineers, and IT professionals to interact with AWS services from the terminal.
Why AWS CLI?
Efficient automation: Automate complex AWS operations through simple command-line scripts.
Multi-service integration: Manage a wide range of AWS services like EC2, S3, RDS, and more—all from one place.
Flexible & scalable: Scale infrastructure, deploy resources, and monitor usage in seconds.
Cross-platform: Available on Windows, macOS, and Linux.
Customizable: Easily integrate with your CI/CD pipelines for seamless deployments.
With the help of the AWS CLI will quickly list all your S3 buckets with just one command!
aws s3 ls
Also we are able to see multiple resources with one command.
From automating deployments to monitoring cloud infrastructure, AWS CLI gives you the control and flexibility to manage your cloud environment more effectively.
Will Start the Practical:
Moving ahead to install CLI, always user the AWS official documents only.
Then click on Documentation @ left pane. Post this click on the User Guide.
As per your OS you can choose the OS to install AWS CLI
I’m Having Windows OS so I will go with the Windows option
Copy the path to your Laptop’s terminal to install the AWS CLI. Once done its showing like below:
If the aws command cannot be found after first installing or updating the AWS CLI, you might need to restart your terminal for it to recognize any PATH updates. Once installed it will take some more time to reflect.
So we successfully installed AWS CLI.
We can check with the following aws - - version command whether cli has been installed or not. Post execution of this command we have received following output.
AWS CLI Successfully installed.
Now how to authenticate CLI with my specific AWS account. There is one command to authenticate the AWS user i.e. “aws configure”
Will execute this command. Any API access to access them we need Access Keys, API tokens. Access keys are similar to username and password which are used for authentication.
Type aws configure command in laptop’s terminal
Take the Access Key ID from the console. Click on User name Right Pane.
Then click on Security Credentials.
Then scroll down and will see the option “Create access key”
Click on Create Access keys though I am using the Root access so there are security concerns that root access keys are not recomemended.
Click on Create access key & access key has been created.
Click Done.
So once we get this information will go to the terminal and execute the “aws configure”
Now I can check with the very simple command to check “aws s3 ls”.
What AWS CLI does is AWS CLI which installed my machine understands that I want to talk to the AWS S3 service on this AWS and basically with ls command I’m going to list the buckets. It will make the API call and provide the output available buckets.
So we can see the exact bucket which we are able to see on the AWS console.
Now if you want to explore more commands than straight forward go to the document.
So we can try to create a bucket with the help of the documentation:
The following mb command creates a bucket. In this example, the user makes the bucket mybucket. The bucket is created in the region specified in the user's configuration file:
Once we executed the following command the error appears:
This error indicates that you're attempting to create an S3 bucket in a region that doesn't support global buckets. Global buckets are designed to replicate data across multiple regions for high availability and low latency. However, not all regions support this feature
We will try to create a bucket in a specified region. This is just for practice purposes. Please see below screenshot.
I have tried multiple times and it was given an error on the started the error with “\” and output is unknown options “\”
Then I have got multiple errors regarding the bucket name though the bucket name should be unique and it is not occupied by the other users.
So lets see on the AWS Console if a bucket has been created or not?
Yes, the bucket has been created.
With the help of the documentation we can create multiple resources through AWS CLI.
Happy Learning!!