Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Overview

...

This document is designed to help setup and use AWS CLI commands to upload files to ARIA-Share. It will first guide through installing AWS CI and setting up your AWS credentials to allow your system to access the aria-share S3 bucket. Afterwards, the guide will show a variety of commands to upload files and directories from aria-share.

Setup

  1. To install and setup AWS CLI for all users using the macOS command line [1,2]

    1. Download the file using the curl command. The -o option specifies the file name that the downloaded package is written to. In this example, the file is written to AWSCLIV2.pkg in the current folder.

      Code Block
      curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"

    2. Run the standard macOS installer program, specifying the downloaded .pkg file as the source. Use the -pkg parameter to specify the name of the package to install, and the -target / parameter for which drive to install the package to. The files are installed to /usr/local/aws-cli, and a symlink is automatically created in /usr/local/bin. You must include sudo on the command to grant write permissions to those folders.

      Code Block
      sudo installer -pkg ./AWSCLIV2.pkg -target /

    3. To verify the AWS CLI version 2 installed, use the following command as well to verify installation. You should be able to see the version of aws-cli that you are running.

      Code Block
      aws --version

    4. After verifying installation, run the aws configure command to setup your credentials. This will include Access key ID, Secret access key, AWS Region, Output format. To help determine these parameters, please refer to the following links:

      1. Access key ID and secret access key

      2. Region

      3. Output format

    5. The following example shows sample values. Replace them with your own values as described in the following sections.

      Code Block
      $ aws configure
      AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
      AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
      Default region name [None]: us-west-2
      Default output format [None]: json

Commands

  1. How to list objects in aria-share bucket [3]

    Code Block
    aws s3 ls s3://aria-share --recursive --human-readable --summarize

  2. How to upload and download content from aria-share bucket [4,5]

    1. How to upload file to ARIA-share bucket

      Code Block
      aws s3 cp /PATH/OF/FILE_TO_UPLOAD s3://aria-share

    2. How to upload directory to ARIA-share bucket

      Code Block
      aws s3 sync /PATH/OF/DIRECTORY_TO_UPLOAD s3://aria-share

    3. How to download file from ARIA-share bucket

      Code Block
      aws s3 cp s3://aria-share/FILE_TO_DOWNLOAD /PATH/TO/DIRECTORY

    4. How to download directory from ARIA-share bucket

      Code Block
      aws s3 sync s3://aria-share/DIRECTORY_TO_DOWNLOAD /PATH/TO/DIRECTORY

    5. Here are a few flags to use to help make uploads and downloads more efficient

      1. --dryrun (boolean) Displays the operations that would be performed using the specified command without actually running them.

      2. --include (string) Don't exclude files or objects in the command that match the specified pattern. See Use of Exclude and Include Filters for details.

      3. --exclude (string) Exclude all files or objects from the command that matches the specified pattern.

  3. How to remove content from aria-share bucket [6]

    1. How to delete a file to ARIA-share bucket

      Code Block
      aws s3 rm s3://aria-share/FILE_TO_DELETE

    2. How to delete multiple files in a directory from ARIA-share bucket

      Code Block
      aws s3 rm s3://aria-share/DIRECTORY_TO_DELETE_FILES_FROM/ --recursive

    3. How to delete a directory and it content from ARIA-share bucket (difference between previous command “b” is the removal of the tailing “/”)

      Code Block
      aws s3 rm s3://aria-share/DIRECTORY_TO_DELETE --recursive

Resources

  1. Installing the AWS CLI version 2

  2. Quick Configuration with AWS Configure

  3. AWS CLI ls command reference

  4. AWS CLI sync command reference

  5. AWS CLI cp command reference

  6. AWS CLI rm command reference