Aws Cli

Steps to Install AWS CLI on Ubuntu EC2 Instance:

  1. Update the Package List: First, update your package list to ensure you're installing the latest version of the AWS CLI:
    sudo apt update

  2. Install AWS CLI Version 2: AWS CLI version 2 is the recommended version. You can install it by running the following commands:
    Install dependencies:
    sudo apt install unzip curl

    Download the AWS CLI version 2:
    curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

    Unzip the installer:
    unzip awscliv2.zip

    Run the installer:
    sudo ./aws/install

  3. Verify Installation: After installation, verify that AWS CLI version 2 is installed correctly by running:
    aws --version

    You should see something like:
    aws-cli/2.x.x Python/3.x.x Linux/xx.x.x

  4. Configure AWS CLI: If you haven't already configured AWS CLI on this instance, you can run the configuration command to set up your AWS credentials:
    aws configure

    You'll need to provide:

    • AWS Access Key ID

    • AWS Secret Access Key

    • Default region name

    • Default output format (e.g., json)

  5. Run the AWS S3 Command: Once the AWS CLI is installed and configured, you should be able to run your aws s3 ls command:
    aws s3 ls