f. Using Amazon S3 (Optional)

Now that we have access to the AWS CLI, we will use it to create an S3 bucket then upload a file to this bucket. While those steps could be done using the AWS Console, they will give you a good idea of what can be done with the AWS CLI. In addition if interested, you can find more details about S3 on the related documentation page.

Every bucket must have a unique name. If this is not the case Amazon S3 will not allow you to create one.

  1. Go to an AWS Cloud9 terminal and list existing buckets with the command below. You should see several to no buckets.

    aws s3 ls
  2. Make an Amazon S3 Bucket with the command shown below. Please keep in mind that bucket names should be unique so either use a random prefix or postfix or append your name. The bucket name must start by s3://.

    BUCKET_POSTFIX=$(uuidgen --random | cut -d'-' -f1)
    aws s3 mb s3://bucket-${BUCKET_POSTFIX}
    cat << EOF
    ***** Take Note of Your Bucket Name *****
    Bucket Name = bucket-${BUCKET_POSTFIX}
  3. Download a file from the internet to your AWS Cloud9 instance, for example lets retrieve a synthetic subsurface model generally used to test Seismic Imaging algorithms. The file will be downloaded on your AWS Cloud9 Instance, not your computer.

    wget http://s3.amazonaws.com/open.source.geoscience/open_data/seg_eage_salt/SEG_C3NA_Velocity.sgy
  4. Upload the file to your Amazon S3 bucket using

    aws s3 cp ./SEG_C3NA_Velocity.sgy s3://bucket-${BUCKET_POSTFIX}/SEG_C3NA_Velocity.sgy
  5. List the content of your bucket using the command below, alternatively you can use the AWS Console and select the S3 Dashboard the go into your newly created bucket to see the file.

    aws s3 ls s3://bucket-${BUCKET_POSTFIX}/
  6. Once done, you can delete the local version of the file using the command rm or the AWS Cloud9 IDE interface.

    rm SEG_C3NA_Velocity.sgy

    See the process in Cloud9 (click on the image to increase its size). Cloud9 AWS CLI

And the result in the AWS Console: Cloud9 S3 AWS Console

Please keep note of your bucket name as it has been randomly generated, see the Amazon S3 Dashboard if you are unsure in the AWS console