Tengxun cloud top-up channel: tengxun cloud object storage COS actual combat guide!

cloud 2026-07-21 阅读 1
1

If you have encountered these scenarios in your development: preparing to launch a personal blog but not wanting to rent an expensive cloud server for a few static pages, or the massive amount of pictures, videos and log files that explode the traditional server disk after the rapid growth of your business-then it's time to learn about object storage.

Tencent Cloud Object Storage (Cloud Object Storage, referred to as COS) is a powerful weapon for storing massive unstructured data in the cloud. This article will take you to understand the core concepts of COS from scratch and gradually implement them.

Static Website Hosting

and explore it in

Massive Data Management and Cost Optimization

practice on the ground.

What is COS? Ditch the traditional file tree

Traditional file systems, such as computer hard disks or server local disks, use a "directory tree" structure. It is very convenient when the amount of data is small, but when the file reaches millions or even hundreds of millions of levels, the index overhead of the file system will increase sharply, and expansion becomes extremely cumbersome.

COS uses a flat storage architecture

It consists of two core concepts:

Bucket: A container for storing objects, similar to a globally unique root folder ".

Object: The basic unit of storage that contains the file data itself and associated metadata (Metadata). Each object has a unique URI access path.

Tip: Although you can see "folders" in the COS console, it is only a logical representation to conform to human habits. Essentially, the system stores the file path (such as images/photo.jpg) as a key name (Key) as a whole.

Step 1: Speed to get started-turn COS into a static website

Using COS as static website hosting is the least costly and fastest way to get familiar with object storage.

With COS's static website hosting feature, you can use it directly to publish personal blogs, project documents or single-page applications (SPAs, such as Vue/React-built pages), while

No need to deploy and maintain any web server (like Nginx)

.

Operating Steps

Create a bucket: Enter the TencentCloud COS console to create a new bucket. The name must be globally unique, and the region closest to the target user should be selected as far as possible.

Set access permissions: Set the access permissions for the bucket to public read and private write. Security warning: Only public read permissions are allowed. Do not enable public write permissions or grant anonymous users write permissions to prevent malicious tampering or misuse of the bucket.

Turn on static website hosting: In the Basic Configuration menu of the bucket, find the Static website option and turn it on. Index Document: Fill in index.html (the page loaded by default when accessing the root directory). Error Document: Fill in 404.html (Show when no path exists for request

page shown).

Upload webpage content and bind domain name: Upload the packaged front-end resources (HTML, CSS, JS, images, etc.) to the root directory of the bucket. After the static website function is enabled, the system will provide a default node domain name, and you can view the page directly. If you need to match your own independent domain name, you can bind a custom domain name in "Domain Name and Transmission Management" and access CDN acceleration and HTTPS certificates with one click.

Step 2: Advanced Practice-Massive Data Storage and Architecture Design

From static website hosting to production-level business, COS often acts as the "base storage" of the system ". However, in the face of TB or even PB-level massive data, simply uploading files is not enough, but also need to take into account.

Safety

with

Cost

.

1. Security architecture: Never expose the main account key at the front end

When a client (such as a mobile APP, an applet, or a front-end webpage) directly uploads a file, you must not use

SecretId

and

Secret Key

Hard coded in the code.

Recommended strategy: Use a temporary key (STS) for direct transfer

The client requests the server to upload credentials.

The application server calls the Tengxun STS service to generate a temporary key with limited permissions and short-term validity (such as 15 minutes).

After receiving the temporary key, the client directly uploads the file to the bucket through the COS SDK.

This mode of "server-issued voucher + client-side direct transmission" not only protects the security of the key, but also greatly reduces the bandwidth pressure of the application server.

2. Cost optimization: life cycle management (Lifecycle)

For massive amounts of data, the cost of storage determines the sustainability of the architecture. COS offers a variety of storage types, and the price decreases significantly as the frequency of access decreases:

Storage type

Applicable Scenarios

Access delay

Storage costs

Standard Storage

Frequently accessed data (e. g., popular images, static website resources)

Millisecond level

Benchmark Price

low frequency storage

Data accessed occasionally (e. g. monthly reports, backup logs)

Millisecond level

About 60% of standard storage

Archive storage

Rarely accessed data (e. g. annual audit logs, medical raw data)

minutes to hours recovery

Very low (about 20% of standard storage)

Actual combat configuration: set automatic settlement rules

You can configure Lifecycle rules in the COS console:

Automatic conversion from standard storage to low-frequency storage 30 days after file creation.

Files are automatically transferred to archive storage 180 days after they are created.

The deletion is performed automatically 365 days after the file is created.

With lifecycle automation policies, you can maximize savings in storage costs without human intervention.

Summary

Tengxun cloud object storage COS application scenarios are very rich

Rich: It can be both minimalist

Static Website Host

It can also support massive media files.

distributed storage hub

.

From simple console click operation to a comprehensive architecture that combines STS temporary keys, lifecycle settlement, and CDN acceleration, mastering the core mechanism of COS is a key step in building efficient and low-cost cloud applications. Try creating a bucket and deploying your first static page to get started with the flexibility of cloud storage.

1
← 返回新闻中心