The s3hub command provides following features:
- Create a S3 bucket
- List S3 buckets
- List S3 objects in the S3 bucket
- Copy files to S3 bucket
- Delete contents from the S3 bucket
- Delete the S3 bucket
- Interactive mode
go install github.com/nao1215/rainbow/cmd/s3hub@latest
The s3hub command allows you to specify a profile as an option, but it is more user-friendly to use the AWS_PROFILE
environment variable. S3hub operates without requiring the 's3://' protocol to be added to the bucket name.
Interactive mode provides a user-friendly interface for managing S3 resources without the need for command-line arguments. You can use the interactive mode by omitting the arguments.
s3hub
### Create a bucket(s)
```shell
s3hub mb ${YOUR_BUCKET_NAME}
s3hub ls
s3hub ls ${YOUR_BUCKET_NAME}
From local to S3:
s3hub cp ${YOUR_FILE_PATH} ${YOUR_BUCKET_NAME}
From S3 to local:
s3hub cp ${YOUR_BUCKET_NAME} ${YOUR_FILE_PATH}
If you want to delete a specific object, use the following command:
s3hub rm ${CONTENT_PATH_IN_BUCKET}/${S3_KEY}
If you want to delete all contents in a bucket, use the wildcard:
s3hub rm ${YOUR_BUCKET_NAME}/*
When the number of S3 objects is large, we parallelize the deletion process to enhance speed.
s3hub rm --recursive ${YOUR_BUCKET_NAME}