DEV Community

Cover image for Modern Cloud Workflow with Pebl - Part 3
Jin Lee for pebl

Posted on • Edited on • Originally published at docs.pebl.io

Modern Cloud Workflow with Pebl - Part 3

In part 2 we added redis to our application.

In part 3 we are going to explore the object store interface that pebl provides by incorporating it into our application.

Pebl's Object Store Interface

Object stores like S3 have become essential to cloud workloads. They provide massive scalability and a simplified storage model in which an object is the core building block. However utilizing them can be quite complicated, as we need to learn the intricate implementation details of the underlying system.

With pebl we provide the object store as a pseudo filesystem. This means that you access the remote files as if they were on a local filesystem with pebl.open. This gives you access to object store capabilities with the intuitive notion of files:

import pebl

with open("local_file", "w") as f:
  f.write(b"hello!\n")

with pebl.open("cloud_file", "w") as f:
  f.write(b"world!\n")
Enter fullscreen mode Exit fullscreen mode

In a similar fashion, accessing an object is done as a read operation:

import pebl

with pebl.open("cloud_file", "r") as f:
  data = f.read(7).decode()
  print(data)
Enter fullscreen mode Exit fullscreen mode

Simple Example

The key benefit of this interface is that you can easily interlace object store operations anywhere in your code. So try extending the Flask example we've been working with to utilize the object store. Perhaps you can try creating logs for each request and response pair using Flask's after request handler, or maybe you can try managing user uploaded content such as profile images.

Inspecting

Once you have deployed your project that utilizes cloud storage, you can rely on
pebl's console in order to inspect any storage blobs.

  1. First navigate to pebl's console at https://www.pebl.io/console.

  2. Then select the objects tab on the left.
    Example console showing the new objects tab

You should see a full list of all blobs you have used, with their name and size.
Clicking on any blob name will download them so that you can easily inspect their
content.

Next in Part 4

In part 4 we will cover how to use scheduled tasks.

Top comments (0)