mc alias set: Configure an S3 Endpoint for mc
mc alias set stores an endpoint URL, access key, and secret key under a short alias that mc commands then reference.
Before mc can copy or mirror anything, it needs an alias pointing at your storage. In CI you either run alias set from secrets or skip the config file entirely with an MC_HOST_ environment variable.
What it does
mc alias set <alias> <URL> <ACCESS_KEY> <SECRET_KEY> writes an entry to ~/.mc/config.json so later commands can address alias/bucket/key. The URL is the S3 endpoint (https://s3.amazonaws.com for AWS, or your MinIO host).
Common usage
mc alias set myminio https://minio.example.com \
"$MINIO_ACCESS_KEY" "$MINIO_SECRET_KEY"
# AWS S3
mc alias set myaws https://s3.amazonaws.com "$AWS_ACCESS_KEY_ID" "$AWS_SECRET_ACCESS_KEY"
# no config file: pass the whole host via env var
export MC_HOST_myminio="https://${MINIO_ACCESS_KEY}:${MINIO_SECRET_KEY}@minio.example.com"Options
| Argument / var | What it does |
|---|---|
| <alias> | Short name used as alias/bucket/key later |
| <URL> | S3 endpoint URL |
| --api S3v4|S3v2 | Signature version (default S3v4) |
| MC_HOST_<alias> | Full URL with embedded credentials, no config file needed |
| mc alias remove <alias> | Delete an alias |
In CI
Prefer MC_HOST_<alias> from a masked secret so credentials never land in a file on the runner. Confirm the alias with mc ls myminio before a big transfer. For AWS, the endpoint is region-neutral (mc resolves the region), but S3-compatible stores need the exact host.
Common errors in CI
"The Access Key Id you provided does not exist in our records" is InvalidAccessKeyId, a wrong or empty key. "The request signature we calculated does not match" (SignatureDoesNotMatch) is a wrong secret or clock skew. "Get https://...: dial tcp: lookup ...: no such host" means a bad endpoint URL. "Unable to initialize new alias ... 403 Forbidden" means the endpoint rejected the credentials outright.