Day 42: IAM Programmatic access and AWS CLI 🚀 ☁

Day 42: IAM Programmatic access and AWS CLI 🚀 ☁

Today is more of a reading excercise and getting some programmatic access for your AWS account

IAM Programmatic access

In order to access your AWS account from a terminal or system, you can use AWS Access keys and AWS Secret Access keys.

AWS CLI

The AWS Command Line Interface (AWS CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.

The AWS CLI v2 offers several new features including improved installers, new configuration options such as AWS IAM Identity Center (successor to AWS SSO), and various interactive features.

Task-01

  • Create AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from AWS Console.

Task-02

  • Setup and install AWS CLI and configure your account credentials

Let me know if you have any issues while doing the task.

Let’s begin with Task-01

Task 01: Create AWS Access Keys

  1. Log in to AWS Management Console:

    • Go to the AWS Management Console.
  2. Navigate to IAM:

    • Click on your username in the top right corner of the console and select "Security Credentials" from the drop-down menu.

  3. Create a New IAM User:

    • Click on the "Access keys (access key ID and secret access key)" section.

    • Click on "Create Access Key".

  1. Download Access Keys:

    • Your Access Key ID and Secret Access Key will be displayed. Download the CSV file containing the access key information and store it in a secure location.

Let’s begin with Task 02

  1. Launch EC2 instance with below configuration

    • AMI: Ubuntu

    • Instance Type: t2.micro

    • Network Settings: Allow HTTP and HTTPS traffic

  2. Download and Install AWS CLI:

    sudo apt update
    sudo apt install unzip

To install the AWS CLI, run the following commands.

    curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
    unzip awscliv2.zip
    sudo ./aws/install
  1. Check AWS CLI Version:

    • Open your terminal or command prompt and run the following command:

          aws --version
      
    • Ensure that AWS CLI is installed correctly and the version is displayed.

  2. Configure AWS CLI:

    • Run the command:

          aws configure
      
    • Enter your AWS Access Key ID, AWS Secret Access Key, Default region name, and Default output format when prompted.

Example:

    $ aws configure
    AWS Access Key ID [None]: <Your_Access_Key_ID>
    AWS Secret Access Key [None]: <Your_Secret_Access_Key>
    Default region name [None]: us-west-2
    Default output format [None]: json
  1. Verify Configuration:

    • Run a simple AWS CLI command to verify the setup:

      Copy

      Copy

          aws s3 ls
      
    • This command lists your S3 buckets. If configured correctly, you should see a list of your S3 buckets or an empty list if you don't have any.

Thankyou for reading !!!!!