mc mb
Table of Contents
The mc mb
command creates a new bucket or directory at the
specified path.
You can also use mc mb
against the local filesystem to produce
similar results to the mkdir -p
commandline tool.
The following command creates a new bucket mydata
on the
myminio
MinIO deployment. The command creates the bucket
with object locking enabled.
mc mb --with-locks myminio/mydata
The command has the following syntax:
mc [GLOBALFLAGS] mb \
[--ignore-existing] \
[--region "string"] \
[--with-lock] \
ALIAS
Brackets []
indicate optional parameters.
Parameters sharing a line are mutually dependent.
Parameters seperated 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.
Required The MinIO or other S3-compatible service on which to create the new bucket.
For creating a bucket on MinIO, specify the alias and the name of the bucket. For example:
mc mb play/mybucket
For creating a directory on a local filesystem, specify the full path to that directory. For example:
mc ls ~/mydata/object.txt
Directs mc mb
to do nothing if the bucket or directory already
exists.
The region in which to create the specified bucket. Has no effect if the
specified ALIAS
is a filesystem directory.
Enables object locking on the specified
bucket. Has no effect if the specified ALIAS
is a
standalone MinIO deployments or
a filesystem directory.
Important
You can only enable object locking when creating the bucket. Buckets created without object locking cannot use Bucket Lifecycle Management or Bucket Object Locking functionality.
The path to a JSON
formatted configuration file that
mc uses for storing data. See Configuration File for
more information on how mc uses the configuration file.
Enables JSON lines formatted output to the console.
For example:
mc --JSON COMMAND
Disables TLS/SSL certificate verification. Allows TLS connectivity to servers with invalid certificates. Exercise caution when using this option against untrusted S3 hosts.
Displays the current version of mc
.
Use mc mb
to create a bucket on an S3-compatible host. The
--with-lock
option creates the bucket with locking
enabled:
mc mb --with-lock ALIAS/BUCKET
Certain S3 services may restrict the number of buckets a given user or account
can create. For example, Amazon S3 limits each account to
100 buckets. mc mb
may return an
error if the user has reached bucket limits on the target S3 service.
MinIO Object Storage deployments do not place any limits on the number of buckets each user can create.
MinIO follows AWS S3 behavior where you must enable object locking at bucket creation. Buckets created without object can never enable object retention or locking.
Enabling bucket locking does not set any object locking or retention settings. Consider enabling bucket locking as standard practice.
The mc commandline tool is built for compatibility with the AWS S3 API and is tested MinIO and AWS S3 for expected functionality and behavior.
MinIO provides no guarantees for other S3-compatible services, as their S3 API implementation is unknown and therefore unsupported. While mc commands may work as documented, any such usage is at your own risk.
This work is licensed under a Creative Commons Attribution 4.0 International License.
©2020-Present, MinIO, Inc.