S3 Listing
In order to list files in a S3 bucket you need to execute
connect list s3 followed by two mandatory parameters:
--bucketthen the S3 bucket name--regionthen the region where the bucket is located
You can also provide an optional folder with:
-d, --folderthen the folder
Depending on the type of authentication you need to either use --access-key and --secret-access-key for key based authentication
or use the IAM Role Assigned to the Instance (if the server is running on AWS).
Access Key and Secret Access Key
Section titled “Access Key and Secret Access Key”To use the Access Key and Secret Access Key authentication you need to provide:
--access-keythen the Access Key--secret-access-keythen the Secret Access Key
For example:
$ connect list s3 --bucket my-s3-bucket --region eu-central-1 --access-key AKIA4YINCR26KRN42IDA --secret-access-key PHQlr4HsdFijIRCxMqFXDRS8lSh+WBABqFjIQWM42025/05/22 14:24:07 INFO Listing s3://my-s3-bucket/d--------- 0 Jan 01 00:00 folder1/-rw-rw-r-- 1024 Sep 15 21:04 file1.txt-rw-rw-r-- 1024 Sep 15 21:04 file2.txt-rw-rw-r-- 1024 Sep 15 21:04 file3.txtAccess Key and Secret Access Key with AWS CONFIGURE
Section titled “Access Key and Secret Access Key with AWS CONFIGURE”You can use aws configure.
This command prompts you to enter the Access Key ID and Secret Access Key, which are then stored in your AWS CLI configuration file ~/.aws/credentials.
For example:
$ aws configureAWS Access Key ID [None]: AKIA4YINCR26KRN42IDAAWS Secret Access Key [None]: PHQlr4HsdFijIRCxMqFXDRS8lSh+WBABqFjIQWM4Default region name [None]: eu-central-1Default output format [None]:Then you can omit providing the credentials as they will be obtained from the configuration.
$ connect list s3 --bucket my-s3-bucket --region eu-central-12025/05/22 14:25:01 INFO Listing s3://my-s3-bucket/d--------- 0 Jan 01 00:00 folder1/-rw-rw-r-- 1024 Sep 15 21:04 file1.txt-rw-rw-r-- 1024 Sep 15 21:04 file2.txt-rw-rw-r-- 1024 Sep 15 21:04 file3.txtIAM Role Assigned to the Instance
Section titled “IAM Role Assigned to the Instance”If your instance is running in AWS the temporary credentials will be automatically retrieved from the instance metadata (unless you have overridden it with aws configure). You don’t have to specify the credentials then.
For example:
$ connect list s3 --bucket my-s3-bucket --region eu-central-12025/05/22 14:25:17 INFO Listing s3://my-s3-bucket/d--------- 0 Jan 01 00:00 folder1/-rw-rw-r-- 1024 Sep 15 21:04 file1.txt-rw-rw-r-- 1024 Sep 15 21:04 file2.txt-rw-rw-r-- 1024 Sep 15 21:04 file3.txtTarget folder
Section titled “Target folder”You can also specify the optional target folder to list with:
-d, --folderremote folder name
If you don’t specify the folder, the command will list root folder of the bucket.
For example:
$ connect list s3 --bucket my-s3-bucket --region eu-central-1 -d folder12025/05/22 14:28:56 INFO Listing s3://my-s3-bucket/folder1/-rw-rw-r-- 1024 Sep 15 21:11 folder1/file1.txt-rw-rw-r-- 1024 Sep 15 21:11 folder1/file2.txt-rw-rw-r-- 1024 Sep 15 21:11 folder1/file3.txtConnecting to S3-compatible service
Section titled “Connecting to S3-compatible service”To connect to an S3-compatible service like Minio you need to provide the URL using:
--custom-urland then the S3 instance URL
For example:
$ connect list s3 --bucket my-s3-bucket --region auto --custom-url https://my-s3-host.com --access-key AKIA4YINCR26KRN42IDA --secret-access-key PHQlr4HsdFijIRCxMqFXDRS8lSh+WBABqFjIQWM42025/05/22 14:30:28 INFO Listing s3://my-s3-bucket/d--------- 0 Jan 01 00:00 folder1/-rw-rw-r-- 1024 Sep 15 21:04 file1.txt-rw-rw-r-- 1024 Sep 15 21:04 file2.txt-rw-rw-r-- 1024 Sep 15 21:04 file3.txtAll S3 List Options
Section titled “All S3 List Options”Usage: connect list s3 [command] [flags]
Flags: --access-key string S3 access key --bucket string S3 bucket --custom-url string S3 custom URL --region string S3 region --secret-access-key string S3 secret access key
Global Flags: -d, --folder string Folder to list files --godebug Turns on debug mode --help Prints help for the command --log-format string Log output format: text|json (default "text") --no-color Do not use colors in logs --quiet Makes no outputErrors
Section titled “Errors”Please check here for information on the possible errors.