Accidental deletions of data are common and can affect business operations. To address this issue, select one of the preventive methods described in this topic.

Notice The following best practices are a set of general rules, not a compressive set of security solutions. These best practices are for reference only because they may be unsuitable for your environment. We recommend that you remain conscious about data security and take the necessary precautions and preventative measures.

Enable versioning for a bucket

Object Storage Service (OSS) allows you to configure versioning for a bucket to protect objects stored in the bucket. After you enable versioning for a bucket, data that is overwritten or deleted in the bucket is saved as a previous version. Versioning allows you to recover a previous version of an object to protect the object from being accidentally overwritten or deleted.

When versioning is enabled for a bucket, OSS specifies a unique ID for each version of an object stored in the bucket. Perform the following steps in the OSS console:

  • Enable versioning when you create a bucket
    1. Log on to the OSS console.
    2. In the left-side navigation pane, click Buckets. On the Buckets page, click Create Bucket.
    3. In the Create Bucket panel, configure parameters.

      Set Versioning to Enable. For more information about how to configure other parameters, see Create buckets.

    4. Click OK.
  • Enable versioning for an existing bucket
    1. In the left-side navigation pane, click Buckets. On the Buckets page, click the name of the bucket for which you want to enable versioning.
    2. Choose Redundancy for Fault Tolerance > Versioning.
    3. Click Configure. Set Versioning to Enabled.
    4. Click Save.

For more information about versioning, see Overview.

Enable CRR for a bucket

Cross-region replication (CRR) enables the automatic and asynchronous (near real-time) replication of objects across buckets in different OSS regions. Operations such as create and overwrite objects can be synchronized from a source bucket to a destination bucket.

CRR can meet your requirements on cross-region disaster recovery and data replication. You can set Operations of a CRR rule to Add-Change to back up data that is accidentally deleted.

For example, after you set the parameters of a CRR rule based on the following figure, all data in the source bucket named srcbucket is synchronized to the destination bucket named destbucket. This way, an object accidentally deleted in the srcbucket bucket can be found in the destbucket bucket.

src

For more information about CRR, see Cross-region replication.

Configure scheduled backup for a bucket

You can use the scheduled backup feature provided by OSS to back up objects in a bucket to Hybrid Backup Recovery (HBR) on a regular basis. If an object is accidentally lost, you can recover the object from HBR.

For example, after you configure a backup schedule for a bucket named examplebucket based on the configurations in the following figure, HBR backs up all objects in the bucket at the start time and permanently saves the backups in the destination backup vault based on the retention policy. For more information about how to configure scheduled backup, see Configure scheduled backup.

backup

After HBR completes a full backup, you can create an OSS restore job in the HBR console to recover an object accidentally deleted in the examplebucket bucket to the version before the object was deleted. For more information about how to create an OSS restore job, see Create an OSS restore job.