Sending data to an S3 bucket
Connecting to an S3 bucket
Section titled “Connecting to an S3 bucket”To send data to an S3 bucket, you need to execute connect send s3
with following mandatory parameters:
--bucket
then the S3 bucket name--region
then the region where the bucket is located
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).
To use the Access Key and Secret Access Key authentication you need to provide:
--access-key
then the Access Key--secret-access-key
then the Secret Access Key
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
.
Then you can omit providing the credentials as they will be obtained from the configuration.
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.
To connect to an S3-compatible service like Minio you need to provide the URL using:
--custom-url
and then the S3 instance URL
Sending single file to an S3 bucket
Section titled “Sending single file to an S3 bucket”To send a single file to an S3 bucket you should use
--file
followed by the file name to be sent
Following command will send file1.zip
file to an S3 bucket my-s3-bucket
bucket in eu-central-1
region using Access Key and Secret Access Key authentication.
$ connect send s3 --file file1.zip --bucket my-s3-bucket --region eu-central-1 --access-key AKIA4YINCR26KRN42IDA --secret-access-key PHQlr4HsdFijIRCxMqFXDRS8lSh+WBABqFjIQWM42025/06/03 11:05:15 INFO Sending files to s3://my-s3-bucket/2025/06/03 11:05:15 INFO Files to send: count=1[file1.zip] 10.00 MiB / 10.00 MiB done
Sending multiple files to an S3 bucket
Section titled “Sending multiple files to an S3 bucket”If you’d like to send multiple files to an S3 bucket you need to specify either file mask or file regular expression for the files.
--file-mask
a file mask--file-regex
regular expression
This will cause all files that match a certain mask or pattern to be sent. You can also provide an optional source folder that contain the files to be sent:
-s, --src-folder
If you don’t provide the source folder files will be sent from the current folder.
Following command will send all .zip
files from /data
folder to an S3 bucket my-s3-bucket
in eu-central-1
region using Access Key and Secret Access Key authentication.
$ connect send s3 --file-mask "*.zip" -s /data --bucket my-s3-bucket --region eu-central-1 --access-key AKIA4YINCR26KRN42IDA --secret-access-key PHQlr4HsdFijIRCxMqFXDRS8lSh+WBABqFjIQWM42025/06/03 11:06:15 INFO Sending files to s3://my-s3-bucket/2025/06/03 11:06:15 INFO Files to send: count=3[file1.zip] 10.00 MiB / 10.00 MiB done[file2.zip] 10.00 MiB / 10.00 MiB done[file3.zip] 10.00 MiB / 10.00 MiB done
You can also provide an optional destination folder on S3 bucket:
-d, --dst-folder
If you don’t provide the destination folder files will be sent to the “root folder” of the S3 bucket (top-level of the S3 bucket).
In below example all .zip
files from /data
folder will be sent to remote
folder of S3 bucket my-s3-bucket
in eu-central-1
region using Access Key and Secret Access Key authentication.
$ connect send s3 --file-regex ".+\.zip" -s /data -d remote --bucket my-s3-bucket --region eu-central-1 --access-key AKIA4YINCR26KRN42IDA --secret-access-key PHQlr4HsdFijIRCxMqFXDRS8lSh+WBABqFjIQWM42025/06/03 11:07:04 INFO Sending files to s3://my-s3-bucket/2025/06/03 11:07:04 INFO Files to send: count=3[file1.zip] 10.00 MiB / 10.00 MiB done[file2.zip] 10.00 MiB / 10.00 MiB done[file3.zip] 10.00 MiB / 10.00 MiB done
Sending files in batch mode to an S3 bucket
Section titled “Sending files in batch mode to an S3 bucket”When using the application in batch or non-interactive mode, such as in a script or scheduler, you should disable the progress bar by using
--batch
to send files in batch mode
Following command will send all .zip
files from the /data
folder to the remote
folder of S3 bucket my-s3-bucket
in eu-central-1
region using Access Key and Secret Access Key authentication.
$ connect send s3 --file-mask "*.zip" -s /data -d remote --batch --bucket my-s3-bucket --region eu-central-1 --access-key AKIA4YINCR26KRN42IDA --secret-access-key PHQlr4HsdFijIRCxMqFXDRS8lSh+WBABqFjIQWM42025/06/03 11:07:51 INFO Sending files to s3://my-s3-bucket/remote2025/06/03 11:07:51 INFO Files to send: count=32025/06/03 11:07:51 INFO Transferring file=file1.zip targetFolder=remote2025/06/03 11:07:52 INFO File transferred successfully bytesTransferred=10485760 duration=173ms transferRate=57.80MB/s file=file1.zip targetFolder=remote2025/06/03 11:07:52 INFO Transferring file=file2.zip targetFolder=remote2025/06/03 11:07:52 INFO File transferred successfully bytesTransferred=10485760 duration=128ms transferRate=78.10MB/s file=file2.zip targetFolder=remote2025/06/03 11:07:52 INFO Transferring file=file3.zip targetFolder=remote2025/06/03 11:07:52 INFO File transferred successfully bytesTransferred=10485760 duration=126ms transferRate=78.81MB/s file=file3.zip targetFolder=remote
Sending files from scheduler to an S3 bucket
Section titled “Sending files from scheduler to an S3 bucket”When running the application from a scheduler, it’s recommended to ensure only one instance operates on a specific folder. It’s possible to configure the application to create a flag file at startup and delete it upon completion. If another instance tries to start while one is already running, it will detect the flag file and exit. This approach ensures that only one instance of the application runs at any given time. To do that use
--flag
path to the flag file
Following command will send all .zip
files from the /data
folder to the remote
folder of S3 bucket my-s3-bucket
in eu-central-1
region using Access Key and Secret Access Key authentication and /tmp/flag1
as a flag file.
Mind that we are using batch mode as it’s required for the application to run correctly from script or scheduler.
$ connect send s3 --flag /tmp/flag1 --batch --file-mask "*.zip" -s /data -d remote --bucket my-s3-bucket --region eu-central-1 --access-key AKIA4YINCR26KRN42IDA --secret-access-key PHQlr4HsdFijIRCxMqFXDRS8lSh+WBABqFjIQWM42025/06/03 11:09:49 INFO Using flag file: /tmp/flag12025/06/03 11:09:49 INFO Sending files to s3://my-s3-bucket/remote2025/06/03 11:09:49 INFO Files to send: count=32025/06/03 11:09:49 INFO Transferring file=file1.zip targetFolder=remote2025/06/03 11:09:50 INFO File transferred successfully bytesTransferred=10485760 duration=194ms transferRate=51.32MB/s file=file1.zip targetFolder=remote2025/06/03 11:09:50 INFO Transferring file=file2.zip targetFolder=remote2025/06/03 11:09:50 INFO File transferred successfully bytesTransferred=10485760 duration=139ms transferRate=71.70MB/s file=file2.zip targetFolder=remote2025/06/03 11:09:50 INFO Transferring file=file3.zip targetFolder=remote2025/06/03 11:09:50 INFO File transferred successfully bytesTransferred=10485760 duration=129ms transferRate=76.98MB/s file=file3.zip targetFolder=remote2025/06/03 11:09:50 INFO Removing flag file: /tmp/flag1
Sending files in parallel to an S3 bucket
Section titled “Sending files in parallel to an S3 bucket”To speed up file delivery you can send files simultaneously. Application will then send files using multiple sessions. To specify number of concurrent S3 sessions use:
--parallel
number of S3 sessions
Following command will send all .zip
files from the /data
folder to the remote
folder of S3 bucket my-s3-bucket
in eu-central-1
region using 3
parallel sessions.
$ connect send s3 --file-mask "*.zip" -s /data -d remote --batch --parallel 3 --bucket my-s3-bucket --region eu-central-1 --access-key AKIA4YINCR26KRN42IDA --secret-access-key PHQlr4HsdFijIRCxMqFXDRS8lSh+WBABqFjIQWM42025/06/03 11:10:53 INFO Sending files to s3://my-s3-bucket/remote2025/06/03 11:10:53 INFO Files to send: count=32025/06/03 11:10:53 INFO Transferring file=file1.zip targetFolder=remote2025/06/03 11:10:53 INFO Transferring file=file3.zip targetFolder=remote2025/06/03 11:10:53 INFO Transferring file=file2.zip targetFolder=remote2025/06/03 11:10:53 INFO File transferred successfully bytesTransferred=10485760 duration=321ms transferRate=31.07MB/s file=file2.zip targetFolder=remote2025/06/03 11:10:53 INFO File transferred successfully bytesTransferred=10485760 duration=322ms transferRate=30.98MB/s file=file3.zip targetFolder=remote2025/06/03 11:10:53 INFO File transferred successfully bytesTransferred=10485760 duration=323ms transferRate=30.92MB/s file=file1.zip targetFolder=remote
Sending files in sequence to an S3 bucket
Section titled “Sending files in sequence to an S3 bucket”If you don’t specify the --parallel
option then files will be sent using single session in the same order as they showed up on the filesystem (oldest files first).
Action after file is delivered to an S3 bucket
Section titled “Action after file is delivered to an S3 bucket”After file is successfully delivered to remote location it’s possible to remove it from source or move it to a different folder at the source system.
--delete
delete a file after it’s delivered--move-folder
target folder to move the file after it’s delivered
Following command will send all .zip
files from the /data
folder to the remote
folder of S3 bucket my-s3-bucket
in eu-central-1
region using 3
parallel sessions and then move the files to /archive
at the source system.
$ connect send s3 --file-mask "*.zip" -s /data -d remote --batch --parallel 3 --bucket my-s3-bucket --region eu-central-1 --access-key AKIA4YINCR26KRN42IDA --secret-access-key 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 --move-folder /archive2025/06/03 11:20:30 INFO Sending files to s3://my-s3-bucket/remote2025/06/03 11:20:30 INFO Creating folder to move files after successful send2025/06/03 11:20:30 INFO Files to send: count=32025/06/03 11:20:30 INFO Transferring file=file3.zip targetFolder=remote2025/06/03 11:20:30 INFO Transferring file=file2.zip targetFolder=remote2025/06/03 11:20:30 INFO Transferring file=file1.zip targetFolder=remote2025/06/03 11:20:30 INFO File moved to folder folder=/archive file=file1.zip2025/06/03 11:20:30 INFO File transferred successfully bytesTransferred=10485760 duration=344ms transferRate=29.02MB/s file=file1.zip targetFolder=remote2025/06/03 11:20:30 INFO File moved to folder folder=/archive file=file2.zip2025/06/03 11:20:30 INFO File transferred successfully bytesTransferred=10485760 duration=345ms transferRate=28.95MB/s file=file2.zip targetFolder=remote2025/06/03 11:20:30 INFO File moved to folder folder=/archive file=file3.zip2025/06/03 11:20:30 INFO File transferred successfully bytesTransferred=10485760 duration=346ms transferRate=28.89MB/s file=file3.zip targetFolder=remote
Following command will send all .zip
files from the /data
folder to the remote
folder of S3 bucket my-s3-bucket
in eu-central-1
region using 3
parallel sessions and then removes the files from source.
$ connect send s3 --file-mask "*.zip" -s /data -d remote --batch --parallel 3 --bucket my-s3-bucket --region eu-central-1 --access-key AKIA4YINCR26KRN42IDA --secret-access-key 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 --delete2025/06/03 11:22:10 INFO Sending files to s3://my-s3-bucket/remote2025/06/03 11:22:10 INFO Files to send: count=32025/06/03 11:22:10 INFO Transferring file=file3.zip targetFolder=remote2025/06/03 11:22:10 INFO Transferring file=file2.zip targetFolder=remote2025/06/03 11:22:10 INFO Transferring file=file1.zip targetFolder=remote2025/06/03 11:22:10 INFO File deleted file=file2.zip2025/06/03 11:22:10 INFO File transferred successfully bytesTransferred=10485760 duration=327ms transferRate=30.52MB/s file=file2.zip targetFolder=remote2025/06/03 11:22:10 INFO File deleted file=file1.zip2025/06/03 11:22:10 INFO File transferred successfully bytesTransferred=10485760 duration=335ms transferRate=29.83MB/s file=file1.zip targetFolder=remote2025/06/03 11:22:10 INFO File deleted file=file3.zip2025/06/03 11:22:10 INFO File transferred successfully bytesTransferred=10485760 duration=335ms transferRate=29.83MB/s file=file3.zip targetFolder=remote
All S3 Send Options
Section titled “All S3 Send Options”Usage: connect send 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: --batch No progress bars --delete Delete files after successful send -d, --dst-folder string Folder where files should be sent --file string File name to be sent --file-mask string File mask to filter files for sending --file-regex string File regex to filter files for sending --flag string Flag file name --from-mail string From mail used to send notifications (only in batch mode) --godebug Turns on debug mode --help Prints help for the command --log-format string Log output format: text|json (default "text") --mail-format string Mail format [text|html] (only in batch mode) (default "plain") --move-folder string Folder to move files after successful send --no-color Do not use colors in logs --parallel uint Number of sessions used to send files (default 1) --quiet Makes no output -s, --src-folder string Folder containing files to be sent (default "./") --to-mail-failure strings Email list to send failure notification (only in batch mode) --to-mail-success strings Email list to send success notification (only in batch mode)
Errors
Section titled “Errors”Please check here for information on the possible errors.