The following command generates a YAML blueprint for a replicate type batch job and names the file replicate with the .yaml extension:
mc batch generate alias replicate > replicate.yaml
Replace alias with the alias to use to generate the yaml file.
Replace replicate with the type of job to generate a yaml file for.
:mc:mc batch supports the replicate and keyrotate job types.
S3 Compatibility
The mc commandline tool is built for compatibility with the AWS S3 API and is tested with 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.
Job Types
mc batch currently supports the following job task types:
Replicate objects between two MinIO deployments. Provides similar functionality to bucket replication as a batch job rather than continual scanning function.
You can use the following example configuration as the starting point for building your own custom replication batch job:
replicate:apiVersion:v1# source of the objects to be replicatedsource:type:TYPE# valid values are "s3" or "minio"bucket:BUCKETprefix:PREFIX# 'PREFIX' is optional# If your source is the 'local' alias specified to 'mc batch start', then the 'endpoint' and 'credentials' fields are optional and can be omitted# Either the 'source' or 'remote' *must* be the "local" deploymentendpoint:"http[s]://HOSTNAME:PORT"# path: "on|off|auto" # "on" enables path-style bucket lookup. "off" enables virtual host (DNS)-style bucket lookup. Defaults to "auto"credentials:accessKey:ACCESS-KEY# RequiredsecretKey:SECRET-KEY# Required# sessionToken: SESSION-TOKEN # Optional only available when rotating credentials are usedsnowball:# automatically activated if the source is localdisable:false# optionally turn-off snowball archive transferbatch:100# upto this many objects per archiveinmemory:true# indicates if the archive must be staged locally or in-memorycompress:false# S2/Snappy compressed archivesmallerThan:5MiB# create archive for all objects smaller than 5MiBskipErrs:false# skips any source side read() errors# target where the objects must be replicatedtarget:type:TYPE# valid values are "s3" or "minio"bucket:BUCKETprefix:PREFIX# 'PREFIX' is optional# If your source is the 'local' alias specified to 'mc batch start', then the 'endpoint' and 'credentials' fields are optional and can be omitted# Either the 'source' or 'remote' *must* be the "local" deploymentendpoint:"http[s]://HOSTNAME:PORT"# path: "on|off|auto" # "on" enables path-style bucket lookup. "off" enables virtual host (DNS)-style bucket lookup. Defaults to "auto"credentials:accessKey:ACCESS-KEYsecretKey:SECRET-KEY# sessionToken: SESSION-TOKEN # Optional only available when rotating credentials are used# NOTE: All flags are optional# - filtering criteria only applies for all source objects match the criteria# - configurable notification endpoints# - configurable retries for the job (each retry skips successfully previously replaced objects)flags:filter:newerThan:"7d"# match objects newer than this value (e.g. 7d10h31s)olderThan:"7d"# match objects older than this value (e.g. 7d10h31s)createdAfter:"datetime"# match objects created after this date and time in RFC3339 formatcreatedBefore:"datetime"# match objects created before this date and time in RFC3339 format## NOTE: tags are not supported when "source" is remote.# tags:# - key: "name"# value: "pick*" # match objects with tag 'name', with all values starting with 'pick'# metadata:# - key: "content-type"# value: "image/*" # match objects with 'content-type', with all values starting with 'image/'notify:endpoint:"https://notify.endpoint"# notification endpoint to receive job status eventstoken:"Bearer xxxxx"# optional authentication token for the notification endpointretry:attempts:10# number of retries for the job before giving updelay:"500ms"# least amount of delay between each retry
You can use the following example configuration as the starting point for building your own custom key rotation batch job:
keyrotate:apiVersion:v1bucket:BUCKETprefix:PREFIXencryption:type:sse-s3# valid values are sse-s3 and sse-kmskey:<new-kms-key># valid only for sse-kmscontext:<new-kms-key-context># valid only for sse-kms# optional flags based filtering criteria# for all objectsflags:filter:newerThan:"7d"# match objects newer than this value (e.g. 7d10h31s)olderThan:"7d"# match objects older than this value (e.g. 7d10h31s)createdAfter:"date"# match objects created after this date and time in RFC3339 formatcreatedBefore:"date"# match objects created before this date and time in RFC3339 formattags:- key:"name"value:"pick*"# match objects with tag 'name', with all values starting with 'pick'metadata:- key:"content-type"value:"image/*"# match objects with 'content-type', with all values starting with 'image/'kmskey:"key-id"# match objects with KMS key-id (applicable only for sse-kms)notify:endpoint:"https://notify.endpoint"# notification endpoint to receive job status eventstoken:"Bearer xxxxx"# optional authentication token for the notification endpointretry:attempts:10# number of retries for the job before giving updelay:"500ms"# least amount of delay between each retry
You can use the following example configuration as a starting point for building your own custom expiration batch job:
expire:apiVersion:v1bucket:mybucket# Bucket where this job will expire matching objects fromprefix:myprefix# (Optional) Prefix under which this job will expire objects matching the rules below.rules:- type:object # objects with zero ore more older versionsname:NAME# match object names that satisfy the wildcard expression.olderThan:70h# match objects older than this valuecreatedBefore:"2006-01-02T15:04:05.00Z"# match objects created before this date and time in RFC3339 formattags:- key:namevalue:pick*# match objects with tag 'name', all values starting with 'pick'metadata:- key:content-typevalue:image/*# match objects with 'content-type', all values starting with 'image/'size:lessThan:10MiB# match objects with size less than this value (e.g. 10MiB)greaterThan:1MiB# match objects with size greater than this value (e.g. 1MiB)purge:# retainVersions: 0 # (default) delete all versions of the object. This option is the fastest.# retainVersions: 5 # keep the latest 5 versions of the object.- type:deleted# objects with delete marker as their latest versionname:NAME# match object names that satisfy the wildcard expression.olderThan:10h# match objects older than this value (e.g. 7d10h31s)createdBefore:"2006-01-02T15:04:05.00Z"# match objects created before this date and time in RFC3339 formatpurge:# retainVersions: 0 # (default) delete all versions of the object. This option is the fastest.# retainVersions: 5 # keep the latest 5 versions of the object including delete markers.notify:endpoint:https://notify.endpoint# notification endpoint to receive job completion statustoken:Bearer xxxxx# optional authentication token for the notification endpointretry:attempts:10# number of retries for the job before giving updelay:500ms# least amount of delay between each retry