Tengxun Cloud Object Storage COS Novice Guide: Stop Treat Cloud Server as "Unlimited Network Disk!!
Many friends who have just come into contact with cloud computing have had a similar "history of blood and tears":
I bought a 2-core 4G, 50M hard disk cloud server (CVM) and happily built up the website and APP. Early users are few, running smoothly. However, with the development of business, users upload more and more pictures and videos are getting bigger and bigger. Suddenly one day, the system called the police--
The hard drive blew!
At this time, you are faced with two choices: either spend a lot of money to expand the block storage (cloud hard disk) of the cloud server, or watch the system get stuck.
In fact, this practice of stuffing all pictures, videos and static files into the local hard disk of the cloud server is a typical "anti-mode" in the era of cloud computing ". The really smart thing to do is:
Leave the structured code and database on the server, and throw all the "occupied" static files into the Cloud Object Storage (COS).
Today's guide is designed for beginners. We don't need complicated architectural terms, but use the most down-to-earth vernacular to take you to a complete understanding of what Tengxun Cloud COS is, how to use it, and how to save you a lot of real money.
1. what exactly is object storage cos?
If you explain it in one sentence:
COS is a "super large network disk" hung in the cloud, with almost unlimited capacity, extremely cheap price and safe access for everyone ".
Similar to the network disk we usually use, you can build folders, transfer files and share download links in it. But it and ordinary network disk and traditional hard disk has three essential differences:
Flat structure (no real folders): In traditional hard drives, files are stored in layers of folders (tree structure). In COS, all files are plain and straightforward "objects". The folder you see is actually just a virtual one created by Tengxun Cloud with the "Prefix" of the file in order to facilitate your visual habits. This structure allows it to retrieve large amounts of data, fast enough to fly up.
Unlimited capacity: You don't need to predict whether to buy 100G or 1T in advance. As much as you pass it, it will be as big as it is, and there will never be a "lack of space.
Each file comes with its own URL: as long as you allow it, any file passed into COS will automatically generate an exclusive HTTP/HTTPS access link. You can directly post this link to your website code, applet or APP, and users can download or watch it online.
Popular Dismantling of 2. Core Concepts: Buckets, Objects and Access Domain Names
The first time you open the Tengxun Cloud COS console, you may be confused by a bunch of nouns. Steady, in fact, the core of three concepts:
1. Bucket (Bucket)-your "big plate"
The bucket is the basic container in COS. You can think of it as the "root directory" in the network disk or a separate "big plate".
When you create a bucket, you need to give
It has a name (globally unique).
You also need to select a region, such as Shanghai, Beijing or Hong Kong. The novice's principle of avoiding pits: the region of the bucket must be in the same region as your cloud server (CVM) as much as possible! For example, the server is in Shanghai, and the barrel is built in Shanghai. In this way, they can transfer between Tencent cloud intranet, which is extremely fast and completely free.
2. object (Object)-the "dish" on the plate"
Every picture, every video, every PDF document you store in the bucket is called an "object". An object consists of three parts:
Data: The contents of the file itself.
Metadata (Metadata): File attributes, such as file size, modification time, file type (Content-Type), etc.
Key: The unique identifier of the file, that is, its path and file name.
3. Access domain name (Endpoint)
After each bucket is created, Tencent Cloud will give you an official domain name for free.
For example, if your bucket is called my-photo-123456 and is placed in Shanghai, then its access domain name may be my-photo-123456.cos.ap-shanghai.myqcloud.com. You passed an avatar.jpg in this bucket,
That users around the world through
You can see this photo (provided that the permission is open).
3. novice must see: cos how to play is the most economical?
Many people hear "unlimited capacity" and "high availability" and think it must be very expensive. On the contrary, COS is recognized as a "money-saving artifact" in cloud computing ". But the premise is that you have to read its hidden rules of billing.
The billing of COS mainly consists of four parts:
Storage fee flow fee request fee data retrieval fee.
If you want to save money, the key depends on what "storage type" you choose ".
Tengxunyun has kindly divided the storage into several files, just like going to the bank to deposit money on a current and regular basis:
Storage type
A simple explanation
Applicable Scenarios
Billing Features
Standard Storage
"Demand deposits", ready to use
Website pictures, popular videos, App static resources
Storage has the highest unit price, but the cheapest read and traffic, suitable for frequently accessed data.
low frequency storage
"Regular 1 month", occasionally look
Enterprise network disk backup, logs a few months ago
The unit price of storage is half as cheap, but there is an additional "retrieval fee" for each data read ". Suitable for accessing data only 1-2 times per month.
Archive storage
"Regular 1 year", basically don't see
Medical image backup and compliance audit log
The unit price of storage is as low as dust, but the file is in a "frozen" state, and it takes several hours to "thaw" it before you want to see it ".
Novice golden sentence:
If your documents are to be put on the website for netizens across the country to read every day,
No brain select standard storage
; If it is your own database backup, it is only when you plan to make a big deal.
Take it out and use it,
Select Low Frequency or Archive Storage
.
4. follow the steps: How can a novice get started quickly?
In practice, configuring a usable COS requires only three steps:
Step 1: Create a bucket and select the permissions.
Log in to the Tencent Cloud console, search for "Object Storage", and click Create Bucket.
Select the name and region (remember to keep consistent with the server).
The most critical step: choose access rights. Private: No one can open it, only the person with your account key can see it. Suitable for user privacy, confidential documents. Public Read, Private Write: Everyone can see through the link, but only you can upload and delete. The vast majority of students who do websites and small programs choose this one!
Step 2: Upload files and test
Click "Upload File" directly on the console to throw a picture in. After the upload is successful, click the details, copy the "object address (URL)" and paste it in a new browser window. If the picture can be displayed normally, congratulations, your first cloud file server will be set up!
The third step: anti-theft chain settings (refused to do suckers)
There is a risk in the public reading bucket: if someone secretly copies your picture link to their website, every time their website is visited, it consumes
You have to pay for your tengxunyun traffic!
Therefore, after creating a bucket, be sure to open it in [Safety Management]
Anti-theft chain (Hotlink Protection)
. Put your website domain name (such
* .yourdomain.com
) added to the white list. In this way, in addition to your own website, how others refer to this link will report an error.
5. Advanced Play: How Can COS Be Used?
When you are familiar with it, you will find that COS can also unlock many advanced functions that make people call "really sweet" directly:
Static website hosting: If you just do a pure front-end personal blog (only HTML/CSS/JS, no back-end code), you don't even need to buy a cloud server! Directly pass the static code into COS, turn on the "static website hosting" function, bind your domain name, and a website with ultra-low cost and absolutely no downtime is born.
Play acceleration with CDN: When your number of users increases and spreads all over the country, you can directly open Tengxun Cloud CDN (Content Delivery Network) with one click on COS console. Data will be cached in backbone computer rooms across the country, and the access speed of users will soar directly. Moreover, CDN traffic packets are often cheaper than COS native traffic, thus properly "reducing costs and increasing efficiency".
Data Vientiane (CI) Image Processing: The user uploaded a 10MB high-definition mobile phone photo, which will be slow to load directly on the front end. With Tengxun Cloud Data Vientiane, you only need to add a parameter (e. g.? imageMogr2/thumbnail/200x) after the picture link, COS can automatically cut the picture into a small thumbnail with a width of 200 pixels in real time and return it, even saving the code for developing and cutting the picture in the background.
6.
Summary
For cloud computing novices, learning to use object storage COS is the first step to get rid of "student thinking" and move towards a professional architecture.
It separates the storage from the heavy cloud server, not only makes your business system lighter and easier to expand, but also solves the problem of data security backup at a very low cost. I hope this guide can help you cross the threshold of novice smoothly, go to tengxunyun console to open one and experience the silky smoothness of "infinite space!

