Skip to main content

AWSCli Usage - Knowledgebase / Research Systems - SOMTech (Technology Services) - VCU School of Medicine

AWSCli Usage

Authors list

 1 — Install the AWS CLI

Step 1: Package manager system — Update, Upgrade, Makecashe

We need to make sure our package management system is up to date with the latest package versions and also update all metadata for enabled repositories to be used.

Update package manager system —

sudo yum -y update

Upgrade package manager system —

sudo yum -y upgrade

Update package repository cache —

sudo yum -y makecache

Step 2: Download and unzip the AWS CLI installation file

Before we can download the AWS CLI installation zip file, we need to make sure we can unzip it on our CentOS 7 system.

Let’s install “unzip” to enable that functionality —

sudo yum -y install unzip

We can now download the AWS CLI installation zip file over the internet from the official https location and unzip the file.

Note, the option -o in the command below specifies the desired custom file name your downloaded package will be written to.

Download AWS CLI installation file —

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o [file name].zip

Unzip the AWS CLI installation file —

sudo unzip [file name].zip

Step 3: Install AWS CLI on your CentOS 7 Command Line Interface

Finally we can install the AWS CLI. We will install it in “/usr/bin”, this should already be in our $PATH. The $PATH system variable contains a list of directories the system checks before running a command. We can run any executables found in the directories mentioned in $PATH from any directory without having to type out the absolute file path.

Note, when installing the AWS CLI, we need to specify the path, if not, it will automatically be installed in “/usr/local/bin/aws”, which will cause errors.

Run the command below to install the AWS CLI —

./aws/install -i /usr/bin/aws-cli -b /usr/bin

Let us confirm our installation by running the AWS CLI command that display's the current installed version —

aws --version

If you the steps correctly, you will see the current installed AWS CLI version on your screen, as shown below.

2— Configure the AWS CLI

We need to configure the AWS CLI to access our AWS Resources. To configure the settings run the follow command —

aws configure

The AWS CLI will prompt you for four separate information as seen below. Note, I had already configured mine.

To obtain your AWS access key ID and Secret Access key we need to do the following:

  • Open the IAM console at https://console.aws.amazon.com/iam/

  • On the top left pane, click on your IAM User, then the “Security credentials” tab, as shown below

    • Scroll down, then choose “Create access key”. Your credentials should resemble the following:

— Access key ID: AKIAIOSFODNN7EXAMPLE

— Secret access key: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

    • Click on “Download .csv file” to download the file with the keys and store it in a secure location

For the “Default region name”, we will use “us-east-1”.

For the “Default output format”, we will use “json”.

Once you provide all the details, you should see a hidden directory “.aws” created in your home directory using the command — ll -a

You can now test the functionality by running the command —

aws s3 ls

This command lists out all the S3 buckets in your AWS Account.

Note, Create an S3 bucket if you haven’t already made on in your AWS Account).

If you did every step correctly, you will see all your S3 buckets on your screen, as shown below.

Congratulations!

You’ve just successfully completed “QUIC-CLIC-7”. You’ve installed and configured AWS CLI on CentOS 7.

broad institute bucket info

AWS bucket, s3//:neale-irish-scz and generated these keys (also attached):

access key: AKIAR7WYPFSM2LTGWIY5

secret access key: WIaUNms5mC0+xre4sRK+KnVsRLY41uZtSLCTyp+8

  • aws s3 cp ~/test_transfer s3://neale-irish-scz/


More Usage

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o awscli.zip

mkdir awscli

mv awscli.zip  awscli

cd awscli/

unzip awscli.zip

cd aws/

./install -i /usr/bin/aws-cli -b /usr/bin

aws --version

aws configure

cd .aws/

aws s3 ls

aws s3 lsneale-irish-scz

aws s3 ls neale-irish-scz

aws s3 rsync /homebk/ARCHIVE/projects_data/riley_cram/TCD/GD502481401.realigned.cram neale-irish-scz/

Helpful Unhelpful