AWS CLI on your Local machine

AWS CLI on your Local machine

🌟Introduction

In this blog post, we will be discussing various aspects of AWS CLI So, this will help us to make different operations via CLI instead of AWS Console which is (GUI).

In this article, we are considering Windows machine. But for other OS like Linux/Mac, you can refer to the AWS Documentation for the downloading links and commands.

Firstly, you need to have a 64-bit Windows and should have Admin accessing rights.

🌟What is AWS CLI?

The AWS Command Line Interface (CLI) is a unique tool provided by Amazon Web Services (AWS) that allows you to interact with various AWS services from the command line or scripts. It provides a command-line interface to perform actions, manage resources, and automate tasks across different AWS services.

Using the AWS CLI, you can do:

  1. Manage AWS Services: You can create, configure, and manage AWS resources such as Amazon EC2 instances, Amazon S3 buckets, Amazon RDS databases, AWS Lambda functions, and more.

  2. Control AWS Infrastructure: You can manage AWS infrastructure components, including virtual private clouds (VPCs), subnets, security groups, route tables, and network ACLs.

  3. Access AWS Services: You can access and work with AWS services such as Amazon S3 for object storage, Amazon DynamoDB for NoSQL database, AWS CloudFormation for infrastructure as code, AWS IAM for user and access management, AWS Lambda for serverless computing, and many more.

  4. Automate Tasks: The AWS CLI allows you to automate tasks by scripting commands and integrating them into your automation workflows or shell scripts. This helps to streamline and simplify repetitive tasks, making it easier to manage and configure AWS resources.

  5. Secure and Authenticate: The AWS CLI supports authentication using AWS access keys, temporary session tokens, or AWS Identity and Access Management (IAM) roles. It also supports secure communication with AWS services using HTTPS.

  6. Configure and Customize: You can configure the AWS CLI with various settings, including default region, output format, and custom profiles. This allows you to tailor the CLI experience based on your preferences and needs.

🌟How to set up AWS CLI on your local machine?

🔹Install the AWS CLI

  • On Windows: Download the AWS CLI MSI installer from the official AWS CLI website (aws.amazon.com/cli). Run the installer and follow the prompts

Download the AWS CLI MSI installer and wait for a few minutes to finish the installation process.

  • On macOS: Install the AWS CLI using Homebrew by running the following command in the Terminal:

      brew install awscli
    
  • On Linux: Install the AWS CLI using your distribution's package manager. For example, on Ubuntu, you can run:

      sudo apt-get install awscli
    

🔹Configure AWS CLI

  • Open your command line interface (e.g., Command Prompt, Terminal, Git Bash, etc.), here using Git Bash.

  • Run the following commands:

      aws --version
      aws configure
    
  • Once the installation is finished, to verify it open your cmd in Windows and run a command that shows up, and the output is shown below.

  • You will be prompted to enter your AWS Access Key ID, Secret Access Key, default region, and output format.

    • Access Key ID and Secret Access Key: These are your AWS IAM user credentials with appropriate permissions. Obtain them from the AWS Management Console by going to IAM ->Group -> User -> Security Credentials.

    • Default region: Enter the AWS region code (e.g., ap-south-1) that you want to use as the default region for your CLI operations.

    • Output format: Choose the desired output format for CLI commands (e.g., json, python, text, table).

🌟Test the AWS CLI

  • Run the following command to verify that the AWS CLI is properly configured:

    To check whether the credentials are set properly.

      aws sts get-caller-identity
    

    Verify your UserId, Account Number and Arn whether they match with your AWS Account and you are all set to perform AWS tasks via CLI.

    If you have the necessary permissions, this command will list your Amazon S3 buckets.

      aws s3 ls
    

🌟 Conclusion

That's it! You have successfully set up the AWS CLI on your local machine. You can now use various AWS CLI commands to interact with your AWS services such as S3, ec2-instances and so on.

\...................................................................................................................................................

The above information is up to my understanding. Suggestions are always welcome. Thanks for reading this article.

#aws #aws cli #awscloud #DevOps #TrainWithShubham

#90daysofdevopsc #happylearning

Shubham Londhe Sir

Follow for many such contents:

LinkedIn: linkedin.com/in/dushyant-kumar-dk

Blog: dushyantkumark.hashnode.dev