TheKoguryo's Tech Blog

 Version 2024.05.05

Warning

This content has been generated by machine translation. The translations are automated and have not undergone human review or validation.

7.7 Setting up archives through lifecycle

As one of the use cases of Object Storage, it is widely used for disk image backup and file backup. You are more likely to use a recent backup, but you are less likely to use a backup otherwise, but you often need to keep it for a long period of time, for example. You have a requirement that you want to reduce your Storage costs even a little bit during the retention period.

Bucket of Object Storage has a function to manage the life cycle of stored objects. Provides a function to delete objects after a certain period of time has elapsed or move them to cheaper archive storage.

Setting up archives through lifecycle

Step 1. Grant Object Archive permission

  1. Log in to the OCI console as an OCI full administrator.

  2. Add object related policy permission to target group (SandboxGroup)

    Additional privileges are required to do Object Archive. Adds the Manage Object Family permission.

    allow service objectstorage-<region_name> to manage object-family in compartment <compartment_name>
    
    • Example: Name, ObjectStorageLifecyclePolicy

      allow service objectstorage-ap-seoul-1 to manage object-family in compartment Sandbox
      

Step 2. Set the life cycle

  1. Log in to the OCI console as a sandbox group user.

  2. Go to the detail page of the Bucket (eg ExampleBucket) for which you want to set a lifecycle.

  3. Click Resources > Lifecycle Policy Rules in the lower left corner.

  4. Click Create Rule to create a new rule.

    image-20220112211029592

  5. Create lifecycle rules

    • Name: Enter the name of the rule to be created.

    • Lifecycle Action:

      • Select one of Move to Archive, Move to Infrequent Access, or Delete
    • Number of Days: Set the period of time to apply to objects older than a few days after creation

    • Object Name Filters: This is the area to specify the conditions for the target object in the Bucket. Currently, nothing is set.

      • Like images/oracle.png, the prefix ‘images/’ based on the slash in the object name. Prefixes allow you to specify conditions for the target object.

      image-20220112211503811

  6. After setting, click Create.

  7. Lifecycle rules are set. image-20220112212112078

Step 3. Check the archived result

  1. You can see that the set rule has been applied and has become Archived as shown in the figure. image-20220114092509970

  2. In the archived state, download is not possible, so even if you access the object from the public bucket by URL, the following error occurs. image-20220114092717035

Step 4. Restoring

  1. In order to download again in the archived state, restore the target object. image-20220114093721733

  2. The downloadable time is 24 hours by default if no input is made. If you want to change it, you can designate it within the range of 1 hour to 240 hours. After recovery, it can be downloaded only for a specified period of time (default 24 hours), and after that, it becomes Archived again. image-20220114095322462

  3. If you restore the status as shown below, it will take some time to complete. I’ve only tested it once, but here’s how long it took:

    • Request time: Jan 14, 2022 12:48:19 AM, GMT

    • Completion time: 05 08, 2019 11:20, GMT (estimated)

    • Time taken: about 3 hours image-20220114095524867

      image-20220114095727285

  4. When the recovery is complete, you can download it now, and in the case of a public bucket, you can access the object by URL. image-20220114113258028 image-20220114113320661

  5. If you look at the detailed information of the object, the remaining downloadable time based on the set time is displayed as shown in the figure. image-20220114113343985



As an individual, this article was written with my personal time. There may be errors in the content of the article, and the opinions in the article are personal opinions.

Last updated on 14 Jan 2022