a. AWS CLI commands for S3

Now that you have access to the AWS CLI, you can use it to download files from an S3 bucket.

  1. Run an AWS CLI command to list all the S3 buckets associated with the account.
aws s3 ls

The output will list all the S3 buckets (if any) associated with the account.

For the purpose of this workshop we will be using a named profile with AWS CLI which is a collection of settings and credentials that you can apply to a AWS CLI command. When you specify a profile to run a command, the specific settings and credentials associated with the profile are used to run that command. This is typically followed when credentials are shared to access resources. Use the AWS CLI with the credentials (for the named profile) provided during the training to access the S3 bucket folders shared with us for this workshop.

  1. Enter the AWS CLI command to configure AWS Credentials with a profile named “training”.
aws configure  --profile training
  1. Enter the aws access key id provided for the training.
AWS Access Key ID [None]: [Access Key ID]
  1. Next Enter the aws secret key provided for the training.
AWS Secret Access Key [None]: [Secret Access Key]

  1. Enter a Default region name.
Default region name [None]: ap-southeast-1

Hit enter to accept the defaults for output format

  1. Rerun the AWS CLI S3 command to list the folders within an S3 bucket, but this time with the profile. This will show you all folders of the bucket that share the account credentials.
aws s3 ls --profile training s3://slchen-lab-transfer/GIS-training/

The output is a list of folders within the S3 bucket (slchen-lab-tranfer) that is shared.

Expected output:

PRE SRR6327875/
PRE SRR6327950/