Skip to content

Data access instructions from S3 using AWS CLI

ESapenaVentura edited this page Feb 14, 2024 · 8 revisions
  1. Install AWS CLI
  2. Configure
  3. List objects in the S3 bucket
  4. Download an object from the S3 bucket to home directory

Install AWS CLI

Windows

Download the AWS CLI installer for Windows from the official AWS CLI website: AWS CLI install and update instructions - Windows

Run the downloaded installer and follow the installation wizard.

Linux

The installation method may vary depending on your Linux distribution. Here are commands for some popular package managers:

For Debian/Ubuntu: sudo apt-get update sudo apt-get install awscli

For Red Hat/Fedora: sudo yum install aws-cli

For other distributions or to install using Python pip, you can follow the instructions on the official AWS CLI website: AWS CLI install and update instructions - Linux

MacOS

You can install the AWS CLI on macOS using the Homebrew package manager. Open the Terminal and run the following commands:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew install awscli

Alternatively, you can install it using Python pip:

sudo pip3 install awscli

Configure and test

  1. aws configure
  2. Enter the provided access key when prompted.
  3. Enter the provided secret key when prompted.
  4. Enter default region → eu-west-2.
  5. Enter data format → json.
  6. Test -> aws s3 ls s3://morphic-bio-data-release. This command lists the content of the S3 buckets you have access to, helping confirm that your AWS CLI setup is working.

List objects in the S3 bucket

aws s3 ls s3://morphic-bio-data-release

Download an object from the S3 bucket to home directory

Syntax:

aws s3 cp <s3_source_folder> <local_target_folder>

Example command:

aws s3 cp s3://morphic-bio-data-release/December-2023/JAX_RNAseq_ExtraEmbryonic/source/WT_3__Normoxia_GT23-11290_GGACTTGG-CGTCTGCG_S36_L001_R2_001.fastq.gz ./mnt/c/users/User