Updates the status of the Anti-DDoS instances of a bucket.
Usage notes
By default, an Alibaba Cloud account has the permissions to update the status of the Anti-DDoS instances of a bucket. To update the status of the Anti-DDoS instances of a bucket by using a RAM user or Security Token Service (STS), you must have the oss:UpdateBucketAntiDDosInfo
permission. For more information, see Attach a custom policy to a RAM user.
High fees may be incurred by the usage of Anti-DDoS for OSS. We recommend that you enable this feature only when it is necessary.
Command syntax
ossutil api update-bucket-antid-dos-info --bucket value --defender-instance value --defender-status value --bucket-antiddos-configuration value [flags]
Parameter | Type | Description |
--bucket | string | The name of the bucket. |
--bucket-antiddos-configuration | string | The container that stores the configurations of the Anti-DDoS instances. |
--defender-instance | string | The ID of the Anti-DDoS instance. |
--defender-status | string | The new status of the Anti-DDoS instance. |
The update-bucket-antid-dos-info command corresponds to the UpdateBucketAntiDDosInfo operation. For more information about the parameters in the UpdateBucketAntiDDosInfo operation, see UpdateBucketAntiDDosInfo.
--bucket-antiddos-configuration
The --bucket-antiddos-configuration option supports both the XML and JSON formats. If the value of the option contains the file:// prefix, ossutil reads configurations from a configuration file.
XML format:
<BucketAntiDDOSConfiguration> <Cnames> <Domain>string</Domain> ... </Cnames> </BucketAntiDDOSConfiguration>
JSON format:
{ "Cnames": { "Domain": ["string", ...] } }
For more information about supported global command-line options, see Global command-line options.
Examples
The following examples show how to add the abc1.example.cn
and abc2.example.cn
custom domain names to the protection list of the Anti-DDoS instance whose ID is 123
of the examplebucket
bucket and change the status of the Anti-DDoS instance to Init.
Create a configuration file named bucket-antiddos-configuration.xml and add the following code to the configuration file:
<?xml version="1.0" encoding="UTF-8"?> <AntiDDOSConfiguration> <Cnames> <Domain>abc1.example.cn</Domain> <Domain>abc2.example.cn</Domain> </Cnames> </AntiDDOSConfiguration>
Sample command:
ossutil api update-bucket-antid-dos-info --bucket examplebucket --defender-instance 123 --defender-status Init --bucket-antiddos-configuration file://bucket-antiddos-configuration.xml
Create a configuration file named bucket-antiddos-configuration.json and add the following code to the configuration file:
{ "Cnames": { "Domains": ["abc1.example.cn", "abc2.example.cn"] } }
Sample command:
ossutil api update-bucket-antid-dos-info --bucket examplebucket --defender-instance 123 --defender-status Init --bucket-antiddos-configuration file://bucket-antiddos-configuration.json
Configure parameters in the following command in the JSON format:
ossutil api update-bucket-antid-dos-info --bucket examplebucket --defender-instance 123 --defender-status Init --bucket-antiddos-configuration "{\"Cnames\":{\"Domains\":[\"abc1.example.cn\",\"abc2.example.cn\"]}}"