Google Cloud Cloud Storage Combat: Four Storage Level Dismantling and Fully Automated Money Saving Strategies
In the circle of cloud computing, whether you are doing cross-border e-commerce, independent development, writing the back end of small programs, or big data in large factories, you cannot do without a basic rigid need:
save something
.
User-uploaded avatars, high-definition images of goods, App installation packages, daily system logs, and even database backup files ...... These hundreds of GB or even tens of TB of unstructured data, if all stuffed into your cloud server (virtual VM), will not only burst the expensive system disk instantly, but also make the backup and migration of the server extremely bloated.
At this point, you need object storage. In the Google Cloud (GCP) ecosystem, this most solid and cheapest "bottomless pit of the cloud" is called
Cloud Storage (Google Cloud Object Storage, GCS)
.
In today's article, we don't talk about the professional hardware terms that make people dizzy, but use a pure "small white actual combat perspective" to take you through the core concepts of Cloud Storage, the selection and avoidance guide, and how to build your first low-cost cloud storage bucket.
1. look at the world from another angle: what is "object storage"?
Before picking the configuration, let's take a minute to sort out an idea:
What is the difference between object storage and the computer hard disk (or block storage of cloud servers) that we usually use?
Computer hard drive (file storage): like a traditional Chinese medicine shop drawer. If you want to find a file, you must know which folder (directory) it is in. For example: D disk/project/picture/2026/logo.png. When there are millions of files, the efficiency of layer-by-layer search will drop sharply.
Object storage: It's like a luggage storage in an upscale hotel. You give your luggage (documents) to the waiter, who doesn't care what's in the luggage and doesn't need a doll-like folder. It directly gives you a "luggage tag" (that is, a unique URL). In the future, no matter when you hold this luggage tag, you can take out your luggage in one ten thousandth of a second.
In the Cloud Storage, there are only two basic concepts:
Bucket (Bucket): This is your "big warehouse", all your luggage will be thrown into this warehouse.
Object: This is the body of your file, containing the file data, as well as a bunch of "metadata" describing the file (such as file type, upload time, etc.).
2. core selection: four storage levels, choose the wrong one to spend ten times more money
When you open the GCP console to create a bucket, Google will let you choose
Storage Class (storage level)
. This is the most likely place for novices to step on the pit! Many people chose the "next step" all the way to save trouble. As a result, they saw tears falling down the bill at the end of the month.
Google has prepared a total of four levels, and their underlying reliability is exactly the same (a staggering 99.999999999 percent of data is not lost),
The only one
The difference is: how often do you plan to read this data?
1. Standard (standard storage)-"hot data to meet every day"
Features: Read at any time, extremely fast, without any reading costs.
Who is suitable for: the product pictures on the website, the playback source of the video website, and the App installation package that users download frequently every day.
Big vernacular: as long as this document is read by many people every day, it is right to choose it.
2. Nearline (low frequency storage)-"temperature data seen once a month"
Features: The unit price of storage is only about 60% of the standard storage, but if you read it, Google will charge a small "read traffic fee". In addition, documents must be kept for a minimum of 30 days.
Who is suitable for: the business report to be reported to the boss every month and the system operation log of last month.
3. Coldline (cold storage)-"cold data seen quarterly"
Features: The unit price of storage is extremely cheap (about 1/4 of standard storage), but the cost of reading becomes more expensive. Documents must be kept for a minimum of 90 days.
Who is suitable for: financial documents for the last quarter, history records that must be kept in order to meet compliance checks.
4. Archive (archive storage)-"buy insurance, just in case of dead data"
Features: cheap to the realm of fracture, rounding is equal to no money. However, it is extremely expensive to read, and the file must be stored for at least 365 days.
Who is suitable for: the year-end backup of the database. You want to never use it in your life (unless you use it to save your life when your company's servers are blackmailed and completely paralyzed by hackers).
💡Save Money: Fully Automated Lifecycle Management (Lifecycle Management)
Only children make choices, and old drivers want them all! You can create a standard bucket and configure a rule:
"Walk Standard 30 days before the picture is uploaded to ensure that everyone can see it quickly. More than 30 days automatically downgraded to Nearline; More than 90 days automatically downgraded to Coldline pension."
Move your fingers and cut your monthly storage bill in half.
3. actual combat exercise: three steps to configure your first "outside the chain picture server"
The first requirement for many beginners to Storage with Cloud is to put the company's official website picture on it and then use it directly on the web page.
Show it. Let's look at the standard operating procedure:
Step 1: Create a bucket
Log in to the Google Cloud console and search for Cloud Storage.
Click Create.
Give your bucket a globally unique English name (such as my-company-static-assets).
Location type (location type): if it is a Chinese offshore business, it is recommended to select as in the region.
ia-east1 (Taiwan) or asia-northeast1 (Tokyo), close to the user, low latency.
Storage class to select the Standard.
Step 2: Unlock "public access control" (the most critical step)
In order to prevent novices from accidentally leaking private data, Google locks the bucket to death by default.
In the Create page, find
Control access to objects (Object Access Control)
:
It is highly recommended that you choose Uniform (Unified Access Control). This allows you to manage the permissions of the entire bucket with one click, instead of setting permissions for each file separately.
Uncheck the Enforce public access prevention on this bucket. Because we want to make the picture public to the whole world, if we don't cancel this item, people outside will not be able to open the picture.
Click
Create
The storage bucket is built.
Step 3: Let the whole world see your picture
At this time, you uploaded one to it.
banner.jpg
You'll find it still doesn't work. Because you haven't issued a "pass" yet ".
Go to the bucket you just created and click the Permissions (Permissions) tab.
Click Grant Access.
In the New principals box, type a magic word: allUsers (for everyone on the Internet).
In the Assign roles drop-down menu, search for and select Cloud Storage -> Storage Object Viewer. This role is only allowed to be seen by others and is not allowed to be deleted.
Click Save.
Now, go back to the file list and you'll find
banner.jpg
There is a "Public URL" link behind it. Click on it, and your global highly available and unlimited capacity picture server will be completely finished!
Two "Advanced Pit-Avoidance Guides" 4. Commercial-Grade Applications"
When you use Cloud Storage in a real online production environment, be sure to pay attention to the following two "blood and tears":
1. Beware of "Egress Fee"
In the cloud, storing things is usually free, but if you want to take things out (that is, traffic flowing out of Google's network), you will be billed.
If your website is visited by hundreds of thousands of people every day and everyone is frantically refreshing the pictures you have in GCS, then the high network traffic fee at the end of the month will make you doubt your life.
Correct Architecture: Never let users directly rush your Cloud Storage! You should hang a Cloud CDN in front of the bucket.
(Content Distribution Network). Let CDN cache pictures to edge sites around the world, and users visit CDN, which is not only dozens of times faster, but also can enjoy cheaper CDN traffic package prices.
2. Don't use it as a "database" for high-frequency reading and writing"
Some novice diagrams are convenient. When writing crawler code or user chat rooms, the program is directly asked to frequently put tens of KB one by one.
.txt
or
.json
The file is written into the Cloud Storage.
Warning: Cloud Storage charges depend not only on capacity, but also on the number of API calls (Class A / Class B specification). Every 10,000 writes and reads are paid. If your program reads and writes tens of thousands of times a second, even if the file size is small, the bill for API calls at the end of the month will surprise you. For high-frequency and fragmentary data reading and writing, please honestly use Redis or Firestore database.
Conclusion
Google Cloud's Cloud Storage is like a "treasure chest" hidden in the background ". It is low-key, stable, but has almost unlimited throughput capacity.
For novices in cloud computing, they understand the characteristics of the four storage levels and learn to use them.
allUsers
You have mastered 90% of the essence of this technology by uniformly controlling the public authority and avoiding the pit of traffic back to the source. Pack up the heavy assets in the server and throw them into this "big warehouse" to make your lightweight virtual machines go into battle. This is the elegant posture that modern cloud native architects should have.

