Get started with Edge KV

更新时间:
复制 MD 格式

Learn the basics of Edge KV: create a namespace, read and write key-value data, and integrate with the Edge Routine API.

Limitations

Item

Description

Storage space

  • An Alibaba Cloud account can have up to 10 GB of storage space.

  • A single namespace can have up to 1 GB of storage space.

Key-value

  • Each key can be up to 512 bytes and allows only letters, numbers, -, and _. Special characters such as spaces or question marks are not allowed.

  • Value: Maximum 1.8 MB.

    Note

    Each key-value pair belongs to a namespace.

Synchronization time

Edge KV guarantees eventual consistency. Data typically syncs to all points of presence (POPs) within seconds, guaranteed within 300 seconds.

Access limit

Edge Routines can only access Edge KV data within the same Alibaba Cloud account. Cross-account access is not supported.

Use Edge KV

After enabling Edge KV, manage data through the ESA (Edge Security Acceleration) console or the Edge Routine API.

image

Create a namespace

Note

Namespaces are isolated. You can create up to 10 namespaces.

  1. Log on to the ESA console, and in the navigation pane on the left, choose Edge Computing and AI > KV Storage.

  2. Click Create Namespace, and enter the Namespace Name and Description.

    Note

    The Namespace Name corresponds to the namespace parameter in the Edge Routine built-in API.

    Create a namespace

  3. Click OK.

Manage data

Console

Note

The ESA console supports values up to 100 KB. For larger values, use the Edge Routine API.

Use the ESA console to add, modify, or delete Edge KV data.

  1. Log on to the ESA console, and in the navigation pane on the left, choose Edge Computing and AI > KV Storage.

  2. In the namespace list, find the target namespace and click Manage in the Actions column.

  3. Click Add Key-Value Pair, and enter the Key and Value.8

  4. Click OK.

  5. (Optional) After adding data, click Modify, View, or Delete to manage it.

API

Use the Edge Routine built-in API to add, modify, query, or delete Edge KV data.

Important
  • Create a namespace in the ESA console before using the API. Edge KV API.

  1. Call the Constructor and pass the namespace parameter to create a key-value object.

    Namespace Name is the namespace name you created in the console, shown in the namespace list.

    const edgeKv = new EdgeKV({ namespace: "ns"});
  2. After creating the key-value object, call these built-in APIs.

    API

    Description

    get

    Reads data from a namespace.

    put

    Writes or updates key-value data in a namespace.

    delete

    Deletes a key and its value from a namespace.