setmeta (set object's metadata)

Top  Previous  Next

setmeta [BUCKET_NAME]/[FOLDER]/OBJECT [-s] [-r] [-replace] [-meta:META] [-e:+/-] [-rr:+/-] [-ia:+/-] [-sim] [-cond:"FILTER"] [-include:INCL] [-exclude:EXCL] [-rinclude:INCL] [-rexclude:EXCL] [-inclenc] [-exclenc] [-inclrr] [-exclrr] [-inclia] [-exclia] [-inclgl] [-exclgl] [-inclle] [-exclle]

Set the S3 metadata headers associated with one or multiple objects.

 

Parameter

Description

Examples

[BUCKET_NAME]/[FOLDER]/OBJECT

Name / path of the object(s) to set metadata for. Wildcard characters are supported by default (* and ?) to match multiple objects. A regular expression can be used too, in that case use the flag -r on the command line, see below.

setmeta mybucket/file -meta:"cache-control:max-age=60" (set header cache-control:max-age=60  to mybucket/file)

 

setmeta mybucket/* -meta:"cache-control:max-age=60" (set header cache-control:max-age=60  to all files in mybucket)

-s

Recursive, e.g. include all objects in all subfolders when processing multiple objects with wildcard characters or regular expression.

setmeta mybucket/* -s -meta:"cache-control:max-age=60" (set header cache-control:max-age=60  to all files in mybucket including in subfolders)

-r

Regular expression. This flag specifies that [BUCKET_NAME]/[FOLDER]/[OBJECT] is a regular expression.

cd mybucket (set working location to mybucket)

 

followed by

 

setacl ^(a.*)|(b.*)|(c.*) -s -meta:"cache-control:max-age=60" (set header cache-control:max-age=60 to all files starting with a, b or c in mybucket, including files in all subfolders of mybucket)

-replace

Replace the existing metadata headers with the new metadata headers specified with the flag -meta. If -replace is not specified, the new metadata headers specified with the flag -meta will be added to the object(s).

setmeta mybucket/* -meta:"cache-control:max-age=60" -replace (set header cache-control:max-age=60  to all files in mybucket and remove all other metadata)

-meta:META

Metadata headers to be added. Multiple metadata headers should be separated by |.

setmeta mybucket/subfolder/file -meta:"cache-control:max-age=60|x-amz-meta-test:yes" (set header cache-control:max-age=60 and x-amz-meta-test:yes to mybucket/subfolder/file)

-e:+/-

-e:+ sets the object S3 server side encryption header 'x-amz-server-side-encryption:AES256'.

 

-e:- removes the object S3 server side encryption header 'x-amz-server-side-encryption:AES256'.

setmeta mybucket/subfolder/file -e:+ (set header 'x-amz-server-side-encryption=AES256' to mybucket/subfolder/file, that will encrypt the file)

 

setmeta mybucket/subfolder/file -e:- (remove header 'x-amz-server-side-encryption=AES256' from mybucket/subfolder/file, that will decrypt the file)

-rr:+/-

-rr:+ sets the object S3 storage class to Reduced Redundancy: 'x-amz-storage-class:REDUCED_REDUNDANCY'.

 

-rr:- removes the object S3 storage class Reduced Redundancy: 'x-amz-storage-class:REDUCED_REDUNDANCY'.

setmeta mybucket/subfolder/file -rr:+ (set header 'x-amz-storage-class=REDUCED_REDUNDANCY' to mybucket/subfolder/file)

 

setmeta mybucket/subfolder/file -rr:- (remove header 'x-amz-storage-class=REDUCED_REDUNDANCY' from mybucket/subfolder/file)

-ia:+/-

-ia:+ sets the object S3 storage class to Infrequent Access: 'x-amz-storage-class:STANDARD_IA'.

 

-ia:- removes the object S3 storage class Infrequent Access: 'x-amz-storage-class:STANDARD_IA'.

setmeta mybucket/subfolder/file -ia:+ (set header 'x-amz-storage-class=STANDARD_IA' to mybucket/subfolder/file)

 

setmeta mybucket/subfolder/file -ia:- (remove header 'x-amz-storage-class=STANDARD_IA' from mybucket/subfolder/file)

-sim

Simulation. Only preview how the metadata would be set and do not actually set the metadata headers yet.

setmeta mybucket/* -meta:"cache-control:max-age=60" -sim (list which files would get the header cache-control:max-age=60 applied to)

-cond:
"FILTER"

Filter condition. Only apply the metatdata to objects matching the specified condition. More info on filter condition syntax and variables.

setmeta mybucket/* -meta:"cache-control:max-age=60" -cond:"size_mb > 5" (set cache-control:max-age=60 to all files in mybucket that are larger than 5 MB)

-include:INCL

Only apply the metatdata to objects matching the specified mask (Wildcards). Separate multiple masks with "|".

setmeta mybucket/subfolder/file -meta:"x-amz-meta-test:yes" - include:"*.exe|*.rpt"

-exclude:EXCL

Do not apply the metatdata to objects matching the specified mask (Wildcards). Separate multiple masks with "|".

setmeta mybucket/subfolder/file -meta:"x-amz-meta-test:yes" - exclude:"*.exe|*.rpt"

-rinclude:INCL

Only apply the metatdata to objects matching the specified mask (Regular Expression).

setmeta mybucket/subfolder/file -meta:"x-amz-meta-test:yes" - rinclude:"IMGP[0-9]{4}.jpg"

-rexclude:EXCL

Do not apply the metatdata to objects matching the specified mask (Regular Expression).

setmeta mybucket/subfolder/file -meta:"x-amz-meta-test:yes" - rexclude:"IMGP[0-9]{4}.jpg"

-inclenc
-exclenc

Apply the metatdata only to server-side encrypted files.
Do not apply the metatdata to server-side encrypted files.

setmeta mybucket/subfolder/file -meta:"x-amz-meta-test:yes" -inclenc

-inclrr
-exclrr

Apply the metatdata only to reduced redundancy files.

Do not apply the metatdata to reduced redundancy files.

setmeta mybucket/subfolder/file -meta:"x-amz-meta-test:yes" -inclrr

-inclia
-exclia

Apply the metatdata only to infrequent access files.

Do not apply the metatdata to infrequent access files.

setmeta mybucket/subfolder/file -meta:"x-amz-meta-test:yes" -inclia

-inclgl
-exclgl

Apply the metatdata only to Glacier files.

Do not apply the metatdata to Glacier files.

setmeta mybucket/subfolder/file -meta:"x-amz-meta-test:yes" -inclgl

-inclle
-exclle

Apply the metatdata only to client-side (locally) encrypted files.

Do not apply the metatdata to client-side (locally) encrypted files.

setmeta mybucket/subfolder/file -meta:"x-amz-meta-test:yes" -inclle