This topic describes commands related to buckets.
osscmd was deprecated on July 31, 2019. Alibaba Cloud no longer maintains or updates osscmd. Its commands are integrated into ossutil. Use ossutil instead.
config
Description:
config --id=[accessid] --key=[accesskey] --host=[host] --sts_token=[sts_token]Examples:
python osscmd config --id=your_id --key=your_keypython osscmd config --id=your_id --key=your_key --host=oss-internal.aliyuncs.com
getallbucket(gs)
Description:
getallbucket(gs)
Lists all buckets that you created. `gs` is an alias for `getallbucket`. The `gs` and `getallbucket` commands have the same effect.
Examples:
python osscmd getallbucketpython osscmd gs
createbucket(cb,mb,pb)
Description:
createbucket(cb,mb,pb) oss://bucket --acl=[acl]
Creates a bucket.
`cb` is an alias for `create bucket`, `mb` is an alias for `make bucket`, and `pb` is an alias for `put bucket`.
`oss://bucket` specifies the bucket.
The `acl` parameter is optional.
Examples:
python osscmd createbucket oss://mybucketpython osscmd cb oss://myfirstbucket --acl=public-readpython osscmd mb oss://mysecondbucket --acl=privatepython osscmd pb oss://mythirdbucket
deletebucket(db)
Description:
deletebucket(db) oss://bucket
Deletes a bucket. `db` is an alias for `delete bucket`.
Examples:
python osscmd deletebucket oss://mybucketpython osscmd db oss://myfirstbucket
deletewholebucket
This command deletes all data, which cannot be recovered. Use this command with caution.
Description:
deletewholebucket oss://bucket
Deletes a bucket and all its content, including objects and parts of multipart uploads.
Example:
python osscmd deletewholebucket oss://mybucket
getacl
Description:
getacl oss://bucket
Retrieves the access control list (ACL) of a bucket.
Example:
python osscmd getacl oss://mybucket
setacl
Description:
setacl oss://bucket --acl=[acl]
Modifies the ACL of a bucket. Valid values for the `acl` parameter are `private`, `public-read`, and `public-read-write`.
Example:
python osscmd setacl oss://mybucket --acl=private
putlifecycle
Description:
putlifecycle oss://mybucket lifecycle.xml
Configures lifecycle rules. In this command, `lifecycle.xml` is the lifecycle configuration file in XML format. For more information about how to configure the rules, see API Reference.
Example:
python osscmd putlifecycle oss://mybucket lifecycle.xml
Example:
<LifecycleConfiguration>
<Rule>
<ID>1125</ID>
<Prefix>log_backup/</Prefix>
<Status>Enabled</Status>
<Expiration>
<Days>2</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>getlifecycle
Description:
osscmd getlifecycle oss://bucket
Retrieves the lifecycle rules of the bucket.
Example:
python osscmd getlifecycle oss://mybucket
deletelifecycle
Description:
osscmd deletelifecycle oss://bucket
Deletes all lifecycle rules from the bucket.
Example:
python osscmd deletelifecycle oss://mybucket
putreferer
Description:
osscmd putreferer oss://bucket --allow_empty_referer=[true|false]
--referer=[referer]Configures hotlink protection rules. The allow_empty_referer parameter is required and specifies whether to allow requests with an empty Referer header. The referer parameter specifies the whitelist, such as "www.example.com,www.example.org". Use commas (,) to separate multiple domain names. For more information about the configuration rules, see Product Documentation.
Example:
python osscmd putreferer oss://mybucket --allow_empty_referer=true
--referer="www.example.com,www.example.org"getreferer
Description:
osscmd getreferer oss://bucket
Retrieves the hotlink protection settings of the bucket.
Example:
python osscmd getreferer oss://mybucket
putlogging
Description:
osscmd putlogging oss://source_bucket oss://target_bucket/[prefix]
`source_bucket` is the bucket for which you want to record access logs. `target_bucket` is the bucket where the logs are stored. You can set a prefix for the log files of the source bucket to categorize and query them easily.
Example:
python osscmd getlogging oss://mybucket
getlogging
Description:
osscmd getlogging oss://bucket
Retrieves the logging settings of the bucket.
Example:
python osscmd getlogging oss://mybucket