mc admin accesskey create
The mc admin accesskey create command adds a new access key and secret key pair for an existing MinIO AIStor user.
Syntax
The following command creates a new access key associated to an existing MinIO AIStor user:
mc admin accesskey create \
myaistor/ myuser \
--access-key myuseraccesskey \
--secret-key myusersecretkey \
--policy /path/to/policy.jsonThe command returns the access key and secret key for the new account.
The command has the following syntax:
mc [GLOBALFLAGS] admin accesskey create \
ALIAS \
[USER] \
[--access-key string] \
[--secret-key string] \
[--policy path] \
[--name string] \
[--description string] \
[--expiry-duration value] \
[--expiry date]- 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
ALIAS
Required
The alias of the MinIO AIStor deployment.
USER
Optional
The username of the user to which MinIO AIStor adds the new access key. If not specified, MinIO AIStor generates an access key/secret key pair for the authenticated user.
--access-key
Optional
A string to use as the access key for this account. Omit to let MinIO AIStor autogenerate a random 20 character value.
Access Key names must be unique across all users.
--description
Optional
Add a description for the access key. For example, you might specify the reason the access key exists.
--expiry
Optional
The future date and time when the access key expires. The access key becomes invalid at the start of the specified date and time (midnight if no time is specified).
Supported formats:
| Format | Example | Description |
|---|---|---|
YYYY-MM-DD | 2030-12-31 | Expires at midnight (00:00:00) on the specified date |
YYYY-MM-DDTHH:MM | 2030-12-31T23:59 | Expires at the specified date and time |
YYYY-MM-DDTHH:MM:SS | 2030-12-31T23:59:59 | Expires at the specified date, time, and seconds |
| RFC3339 | 2030-12-31T23:59:59Z | Expires at the specified UTC time |
Dates without a timezone use the local timezone of the machine running the command.
Use RFC3339 format with Z suffix or timezone offset for explicit UTC times.
Mutually exclusive with --expiry-duration.
--expiry-duration
Optional
Length of time for which the accesskey remains valid.
Specify the length as one or more number-unit pairs, such as 24h, 2w, or 5d12h30s.
Valid units are ns (nanoseconds), us or µs (microseconds), ms (milliseconds), s (seconds), m (minutes), h (hours), d (days), w (weeks), and y (years).
mc counts one day as 24 hours, one week as 7 days, and one year as 365 days.
The following expires the credentials after 30 days:
--expiry-duration 30dMutually exclusive with --expiry.
--name
Optional
Add a human-readable name for the access key.
--policy
Optional
The readable path to a policy document to attach to the new access key, with a maximum size of 4096 bytes. The attached policy cannot grant access to any action or resource not explicitly allowed by the parent user’s policy or group policies
--secret-key
Optional
The secret key to associate with the new account. Omit to let MinIO AIStor autogenerate a random 40-character value.
Global Flags
This command supports any of the global flags.
Examples
Create access key / secret key pair for the authenticated user
The following command generates a new, random access key and secret key pair for the user currently logged in to MinIO AIStor deployment at the alias myaistor.
The access key and secret key have the same access policies as the authenticated user.
mc admin accesskey create myaistor/Create a custom access key / secret key pair for the authenticated user
The following command creates a new access key and secret key pair for the user currently logged in to MinIO AIStor at the alias myaistor.
The access key and secret key have the same access policies as the authenticated user.
mc admin accesskey create myaistor/ --access-key myaccesskey --secret-key mysecretkeyCreate an access key / secret key pair for another user with limited duration
The following command creates a new access key and secret key pair for a user, aistoruser on the alias myaistor.
The access key and secret key have the same access policies as aistoruser.
The credentials remain valid for 24 hours after creation.
mc admin accesskey create myaistor/ aistoruser --expiry-duration 24hCreate access key / secret key pair for the authenticated user that expires
The following command generates a new and random access key and random secret key pair for the user currently logged in to MinIO AIStor deployment at the alias myaistor.
The access key and secret key have the same access policies as the authenticated user.
The credentials expire on the fifteenth day of January, 2027.
mc admin accesskey create myaistor/ --expiry 2027-01-15The date specified must be a future date.
For valid datetime formats, see the --expiry flag.
Create access key / secret key pair for a different user with custom access
The following command creates a new access key and secret key pair for the user, aistoruser on the alias myaistor.
The access key and secret key have a more limited set of access than aistoruser, as specified in the policy JSON file.
mc admin accesskey create myaistor/ aistoruser --policy /path/to/policy.jsonThe specified policy file must not grant access to anything to which aistoruser does not already have access.
Behavior
S3 compatibility
This command uses a MinIO AIStor administrative API and does not work against other S3-compatible services.