Managing S3 buckets using AWS CLI

The S3 APIs for managing buckets can be used to manage the S3 buckets at the S3 client. The S3 command of the AWS command line interface (CLI) is used in the following step to create buckets. An alias is created for the AWS CLI that uses the S3 access keys and the CES IP of the CES node where S3 is enabled and running. This procedure is an example of managing S3 buckets. The listing of buckets and objects does not show any results, because no buckets or objects are created.

Example

  1. Create an alias on the application node.
    alias s3u9k='AWS_ACCESS_KEY_ID=ei2ISlcY7mvBldlEpa9Z AWS_SECRET_ACCESS_KEY=g9LXRBF8bABudHoM0G7YDUBEqLy/XA4tXnXS77vF aws --endpoint https://172.20.100.33:6443 --no-verify-ssl s3' 
    Note: Here the endpoint URL has the CES IP, which is shared by the system administrator with all the application users. In cluster environment, the DNS is configured and the CES IP address or name are directed appropriately to the S3 service, which is running on the protocol node.
  2. List the buckets , if any.
    s3u9k ls
  3. Create a bucket by using the AWS CLI command. The bucket is created.
    s3u9k mb s3://newbucket-9kuser
    A sample output is as follows:
    make_bucket: newbucket-9kuser
  4. List the bucket by using the AWS CLI command. The bucket is listed.
    s3u9k ls
    A sample output is as follows:
    2024-07-03 05:38:20 newbucket-9kuser 
  5. Upload the objects to the respective bucket.
    s3u9k cp /root/file_1M s3://newbucket-9kuser
    A sample output is as follows:
    upload: ./file_1M to s3://newbucket-9kuser/file_1M 
  6. Download the objects from the bucket.
    s3u9k cp s3://newbucket-9kuser/file_1M file_2M
    A sample output is as follows:
    download: s3://newbucket-9kuser/file_1M to file_2M
  7. List the content of the S3 bucket. The uploaded file is listed.
    s3u9k ls s3://newbucket-9kuser
    A sample output is as follows:
    2024-07-03 05:51:47 1048576 file_1M 
    The S3 user is unaware of where the object is stored in the underlying filesystem. The S3 protocol creates the buckets under the NewBucketsPath mentioned while creating the S3 user account.