mc put
New in version mc: RELEASE.2024-02-24T01-33-20Z
Syntax
The mc put
uploads an object from the local file system to a bucket on a target S3 deployment.
mc put
provides a simplified interface for uploading files compared to mc cp
or mc mirror
.
mc put
uses a one-way upload function that trades efficiency for the power and complexity of the other commands.
The following uploads the file logo.png
from the local file system at path ~/images/collateral/
to a bucket called marketing
on the MinIO deployment with the alias of minio
.
mc put ~/images/collateral/logo.png minio/marketing
The command has the following syntax:
mc [GLOBALFLAGS] put \
TARGET \
[--encrypt-key value] \
[--encrypt value] \
[--parallel, -P integer] \
[--part-size, -s string]
Brackets
[]
indicate optional parameters.Parameters sharing a line are mutually dependent.
Parameters separated using the pipe
|
operator are mutually exclusive.
Copy the example to a text editor and modify as-needed before running the command in the terminal/shell.
Parameters
- TARGET
- Required
The full path to the alias or prefix where the command should run. The TARGET must contain an alias and
bucket
name.The TARGET may also contain the following optional components: - PREFIX where the object should upload to - OBJECT-NAME to use in place of the file names
Valid TARGETs could take any of the following forms: -
ALIAS/BUCKET
-ALIAS/BUCKET/PREFIX
-ALIAS/BUCKET/OBJECT-NAME
-ALIAS/BUCKET/PREFIX/OBJECT-NAME
- --encrypt
- Optional
Specify the key to use for decrypting and encrypting the uploaded object.
Requires that you also specify the key to use with the
--encrypt-key
flag.Alternatively, set the
MC_ENCRYPT
environment variable.
- --encrypt-key
- Optional
Specify the key to use for decrypting and encrypting the uploaded object.
Requires that you also pass the
--encrypt
flag set toTRUE
.Alternatively, set the
MC_ENCRYPT_KEY
environment variable.
Global Flags
This command supports any of the global flags.
Examples
Upload a File and Specify the Object Name
The following command uploads the file logo.png
from the local file system to the business
bucket on the minio
deployment, uploading it on the destination as company-logo.png
.
mc put images/collateral/logo.png minio/business/company-logo.png
Upload a Multipart Object in Parallel with a Specified Part Size
The following command uploads a file in chunks of 20MiB each and uploads 8 parts of the file in parallel. 8 parts are uploaded in succession until all parts of the object have uploaded.
mc put ~/videos/collateral/splash-page.mp4 minio/business --parallel 8 --part-size 20MiB