1 Installation

To download and install the AWS Command Line Interface (CLI), please follow the steps below:

Installing AWS CLI on Windows:

  1. Open a web browser and visit the AWS CLI download page: https://aws.amazon.com/cli/

  2. Find the download link for Windows on the page and click to download.

  3. Once the download is complete, run the downloaded installer (.exe file).

  4. Follow the installation wizard instructions. You can choose the default installation options or customize the installation path as needed.

  5. After installation, open Command Prompt or PowerShell and enter the following command to verify that AWS CLI is installed correctly:

    aws --version
    

Installing AWS CLI on macOS:

  1. Open the Terminal application.

  2. Install AWS CLI using Homebrew. If you haven’t installed Homebrew, refer to the guide on the official Homebrew website: https://brew.sh/

  3. In the terminal, run the following command to install AWS CLI:

    brew install awscli
    
  4. After installation, enter the following command to verify that AWS CLI is installed correctly:

    aws --version
    

Installing AWS CLI on Linux:

  1. Open the terminal.

  2. Install AWS CLI using a package manager. For Debian/Ubuntu systems, run the following command:

    sudo apt-get install awscli
    

    For CentOS/RHEL systems, run the following command:

    sudo yum install aws-cli
    
  3. After installation, enter the following command to verify that AWS CLI is installed correctly:

    aws --version
    

If the command executes successfully and displays the version information of AWS CLI, it means AWS CLI has been installed successfully. You can configure it using the aws configure command, entering your AWS access key, default region, and other information as needed for your operations.

2 Configure AWS CLI

After that you need to set up AWS credential:

You need to provide AWS Access Key and AWS Secret Key to access AWS resources. You need to configure the AWS CLI to provide the credentials required to access S3 storage buckets.

Method 1:

You can follow the steps below for configuration:

  1. Open a terminal or command prompt.

  2. Run the following command to start the configuration:

    aws configure
    
  3. Follow the prompts and enter the following information one by one:

    • AWS Access Key ID: Your AWS access key ID.
    • AWS Secret Access Key: Your AWS secret access key.
    • Default region: The AWS region you want to use as default, e.g., “us-west-1”.
    • Output format: You can choose the format for the output results. You can leave this blank to use the default format.
aws configure
AWS Access Key ID [None]: your_access_key
AWS Secret Access Key [None]: your_secret_key
Default region name [None]: us-east-1
Default output format [None]: json

To access your aws configure, go to ~/.aws/config.

Method 2:

The other way to manually edit the config files:

  • Manually edit the ~/.aws/config and ~/.aws/credentials files to contain configuration and credential information respectively. For example:-

  • In ~/.aws/config:

    [default]
    region = us-east-1
    output = txt
    
  • In ~/.aws/credentials:

    [default]
    aws_access_key_id = YOUR_ACCESS_KEY
    aws_secret_access_key = YOUR_SECRET_KEY
    

3 AWS online setup

To get your YOUR_ACCESS_KEY and YOUR_SECRET_KEY, you need to do the following steps:

Creating and managing access keys in the AWS Management Console is an important security operation. Here are the steps to create and manage AWS access keys:

  1. Log in/sign up to your AWS Management Console: https://aws.amazon.com/console/

You should see the following after you log in:

  1. In the top navigation bar, hover over your account name, then select “My Security Credentials.”
  1. In the left navigation pane, choose “Access Keys (Security Credentials).”
  1. In the upper right corner of the page, click “Create Access Key.”

  2. In the pop-up dialog, you have two options:

    • Create a new access key: This will generate a new access key pair. You will see the Access Key ID and Secret Access Key. Please securely store the Secret Access Key as it won’t be displayed again. You can download the key file from this location or copy the access key information to a secure location.

    • Use existing access keys: If you already have access keys, you can view their details here.

  3. After clicking “Close,” you will receive an Access Key ID and Secret Access Key pair. Make sure to safeguard the Secret Access Key and do not share it with others.

  4. Use these credentials for authentication and authorization operations in the AWS CLI or other AWS services.

4 How to use AWS CLI

To check files in your s3 shared link:

aws s3 ls s3://ucla-data-collection/xxxx/
  • Replace s3://ucla-data-collection/xxxx/ into your own s3 url link.

Copy and download the file from s3 url link to your local directory:

aws s3 cp s3://ucla-data-collection/xxx/myppt.pptx /home/zhaoliang/Data
  • Replace s3://ucla-data-collection/xxx/myppt.pptx into the file that you would like to download.
  • Replace /home/zhaoliang/Data into the local directory that you would like to save your file.