With Object Storage, you can store or retrieve data directly from the internet or within the cloud platform. Object Storage stores and manages data as objects that are organized into buckets. Each object has a set of metadata that describes the object.
The data stored in the object storage isn’t tied to any compute instance and can be accessed and used anywhere.
When you create a storage bucket, you can choose from the following storage tiers:
For scenarios in which you want the Object Storage to automatically emit events on changes, you can enable the option of emitting events. You can respond to events and create automation based on the state changes of the resources. Events are structured messages that follow the CloudEvents industry-standard format. For more information about events, see Overview of Events.
The events in object storage are emitted on two levels; the object level and the bucket level. You can respond to events when buckets or objects are created, deleted, or updated.
For a detailed overview of all events, refer to Object Storage events.
You can optionally enable object versioning on your Object Storage resources. Object versioning provides data protection against accidental or malicious object updates, overwrites, or deletions. When versioning is enabled, a new version of an object is created whenever a new object is uploaded, an existing object is overwritten, or an object is deleted.
Read more about object versioning in Using Object Versioning.
Let’s create a storage bucket in the Console to host a simple HTML page.
By default, the buckets are considered a private bucket, and the access to the contents requires authentication and authorization. However, Object Storage supports anonymous, unauthenticated access to a bucket that isn’t in a security zone.
Because we want to host an HTML page and make it publicly accessible, we have to change the bucket visibility from private to public.
Anything uploaded to a public bucket is available for anyone to access. Even if you prevent users from listing objects from the bucket, they can access the object if they know the file name.
To change the bucket visibility:
Let’s create a file called index.html with the following contents:
<!DOCTYPE html> <html> <head> <title>Hello from Storage Bucket!</title> <head> <body> Hello from my Storage Bucket! </body> <html>
Next, we upload this file as an object to the public-website bucket that we created earlier. Because the bucket’s visibility is set to public, we can access the index.html page directly from a URL.
To upload the file:
On the bucket details page, in the Objects section, click Upload.
Drag the index.html file into the section of the Upload Objects dialog box that says Drop files here.
Alternatively, you can click Select files and use the browser dialog box to upload the file.
Click Upload to upload the file.
After the file is uploaded, you can click Close. The uploaded file is displayed in the list of objects, as shown in the figure below.
Each object in the bucket can be accessed through a URL.
Another useful feature of the Object Storage service is defining lifecycle policies. Earlier we mentioned the two tiers of Object Storage: standard and archive. With a lifecycle policy, you can create rules that will either archive or delete the objects older than the specified number of days.
For example, you can create a rule that archives all PNG files older than 10 days. Here’s how you could do that:
A lifecycle policy scenario in which you delete the objects would be if you’re creating temporary data as part of your logic - for example, creating reports that users can download. After users download the report, the data is not needed anymore. Using a lifecycle policy, you could keep it in the bucket for a couple of days and then delete it.
Read more about lifecycle management in Using Object Lifecycle Management.
In this post, you learned about object storage. You saw how to create new buckets, upload objects, make buckets public, and access objects through a URL. You have also learned about lifecycle policies and how to create policies that archive or delete objects, based on rules.
In an upcoming blog post, we’ll show you how to secure Oracle Cloud Infrastructure object storage buckets by using Identity and Access Management (IAM) policies.
Every use case is different. The only way to know if Oracle Cloud Infrastructure is right for you is to try it. You can select either the Oracle Cloud Free Tier or a 30-day free trial, which includes US$300 in credit to get you started with a range of services, including compute, storage, and networking.
Peter Jausovec is a Consulting Solution Architect at Oracle working on cloud-native solutions. He has more than a decade of experience in the field of software development and tech, in various roles such as QA (test), software engineering and leading tech teams. He's been working in the cloud-native space for the past couple of years, and delivering talks and workshops around the world. He authored and co-authored a couple of books, latest being Cloud Native: Using Containers, Functions, and Data to Build Next-Generation Applications.