Your app is growing, and users now upload profile photos and PDF invoices. You could save those files on your server, but what happens when the disk fills up, or when you run three copies of your app and each one has different files?
Google Cloud Storage, often shortened to GCS, solves that problem. It is one safe place for your files, and every part of your app can reach it. You do not manage any disks, and you pay for what you store and use.
Last reviewed: November 2026
In this guide:
- What is Google Cloud Storage?
- Why use it?
- When to use it
- Storage classes
- How to create a bucket and upload a file
- Real-time examples
- Pricing
- FAQs
What Is Google Cloud Storage?
Google Cloud Storage is a managed service for storing files on Google’s infrastructure. It is built for unstructured data, which simply means files such as images, videos, PDFs, CSV exports and backups.

Think of a large warehouse with lockers. The warehouse is Google’s. You rent a locker, put your boxes inside, and label each box. You never worry about the building, the guards or the electricity.
Only two terms really matter here:
- Bucket: The container, like the locker. You choose its name and location.
- Object: A file stored in the bucket, like one box in the locker. One object can be as large as 5 TiB.
Every file has an address that looks like this:
gs://shop-demo-files-2026/invoices/INV-1001.pdf
Here, shop-demo-files-2026 is the bucket, and invoices/INV-1001.pdf is the object name. It looks like a folder path, and you can treat it like one for now.
Google Cloud Storage vs a Database vs Google Drive
New developers often mix these up, so here is a quick way to separate them.
| Tool | Best for | Example |
|---|---|---|
| Google Cloud Storage | Files used by apps and data pipelines | Invoice PDFs, CSV exports, backups |
| Database | Rows that you search and update | Customer names, order status |
| Google Drive | Documents shared between people | Team spreadsheets, meeting notes |
A common pattern uses both Google Cloud Storage and a database. Keep the invoice file in a bucket, and keep only its path in your database table.
Why Use Google Cloud Storage?
- No disks to manage: You do not plan capacity or replace anything. Just add files.
- Works with stateless apps: Google Cloud Run instances lose their local files, so anything important belongs in a bucket.
- Pay for use: Your bill depends on how much you store and how you use it.
- Cheaper options for old data: Move files you rarely open to a lower-cost storage class.
- Protection from mistakes: Soft delete keeps deleted files recoverable for seven days by default.
- Works well with other services: BigQuery, Cloud Run and Eventarc can all work with your buckets.
When to Use Google Cloud Storage
Use Google Cloud Storage when you need to store complete files, such as:
- User uploads in a mobile or web app
- CSV or JSON files waiting to load into BigQuery
- Database backups and old logs
- Reports, invoices and exports
- Datasets for analytics or machine learning
Do not use it as your main database. If your app needs to search rows or update one customer’s phone number, use a database. A bucket stores whole files, not rows.
Google Cloud Storage Classes
In Google Cloud Storage, a storage class decides the balance between storage cost and access cost. The rule is simple: the less often you open a file, the colder its class can be.
| Class | Best for | Minimum storage time | Retrieval fee |
|---|---|---|---|
| Standard | Files you use often | None | None |
| Nearline | Files opened about once a month | 30 days | Yes |
| Coldline | Files opened about once a quarter | 90 days | Yes |
| Archive | Files opened less than once a year | 365 days | Yes |
Here is a detail many people miss: colder does not mean slow. Even Archive data is available within milliseconds. You pay more to read it, but you do not wait hours for it.
If you are not sure, start with Standard. It has no minimum storage time and no retrieval fee, so a wrong guess will not surprise you.
How to Use Google Cloud Storage
Let us create a Google Cloud Storage bucket and upload one file. You can do this in the console or from the command line.
Method 1: Use the Google Cloud Console
- Open the Cloud Storage Buckets page and click Create.
- Enter a unique bucket name, then click Continue.
- Choose Region as the location type and
asia-south1(Mumbai) as the location. Click Continue. - Select the Standard storage class and click Continue.
- Enforce public access prevention, keep access control on Uniform, and click Continue.
- Review the data protection settings, click Continue, then click Create.
- On the Objects tab, click Upload, then Upload files, and choose a file.
Method 2: Use the Command Line
Step 1: Create the bucket. Bucket names are unique across all of Google Cloud, so change this name to your own.
gcloud storage buckets create gs://shop-demo-files-2026 \
--location=asia-south1 \
--default-storage-class=STANDARD \
--uniform-bucket-level-access \
--public-access-prevention
Step 2: Upload a file.
gcloud storage cp invoice.pdf gs://shop-demo-files-2026/invoices/INV-1001.pdf
Step 3: List the files.
gcloud storage ls gs://shop-demo-files-2026/invoices/
Step 4: Download the file back to your computer.
gcloud storage cp gs://shop-demo-files-2026/invoices/INV-1001.pdf .
Method 3: Use Python in Your App
Most real apps talk to Google Cloud Storage from code. Install the client library first:
pip install google-cloud-storage
Then save this as upload_report.py. To run it on your own computer, sign in first with gcloud auth application-default login.
from google.cloud import storage
BUCKET_NAME = "shop-demo-files-2026"
def upload_report(local_file, cloud_name):
client = storage.Client()
bucket = client.bucket(BUCKET_NAME)
blob = bucket.blob(cloud_name)
blob.upload_from_filename(local_file)
print(f"Uploaded {local_file} to gs://{BUCKET_NAME}/{cloud_name}")
def list_reports():
client = storage.Client()
for blob in client.list_blobs(BUCKET_NAME, prefix="reports/"):
print(blob.name, blob.size, "bytes")
if __name__ == "__main__":
upload_report("daily-report.csv", "reports/2026/11/daily-report.csv")
list_reports()
Google’s library calls an object a blob. It means the same thing. Notice that there is no password in this code. The library finds your credentials by itself, and on Cloud Run it can use the service account attached to your app.
Real-Time Examples of Google Cloud Storage
Now let us see how a small online shop would use Google Cloud Storage every day. It is the same sample shop from our Google Cloud Run tutorial.
Example 1: Let a Cloud Run App Save Reports
Problem: The orders-api app creates a report each day. Files saved inside the container disappear when the instance shuts down.
Solution: Give the app permission to add files to one bucket. We will use the orders-api-sa service account from our Google Cloud IAM guide.
gcloud storage buckets add-iam-policy-binding gs://shop-demo-files-2026 \
--member="serviceAccount:orders-api-sa@PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/storage.objectCreator"
This role can create objects, so the Python upload function above will work. It cannot read or delete them. To list reports as well, the app also needs a role such as Storage Object Viewer.
Example 2: Share a Private Invoice with a Temporary Link
Problem: A customer wants to download their invoice, but your bucket must stay private.
Solution: Create a signed URL. It works like a parking token: anyone holding it gets in, but only until it expires.
First, create a service account that can read the bucket, and allow yourself to sign as that account. Replace PROJECT_ID and the email address.
gcloud services enable iamcredentials.googleapis.com
gcloud iam service-accounts create invoice-signer \
--display-name="Creates signed invoice links"
gcloud storage buckets add-iam-policy-binding gs://shop-demo-files-2026 \
--member="serviceAccount:invoice-signer@PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/storage.objectViewer"
gcloud iam service-accounts add-iam-policy-binding \
invoice-signer@PROJECT_ID.iam.gserviceaccount.com \
--member="user:you@example.com" \
--role="roles/iam.serviceAccountTokenCreator"
Now create a link that works for 10 minutes:
gcloud storage sign-url gs://shop-demo-files-2026/invoices/INV-1001.pdf \
--impersonate-service-account=invoice-signer@PROJECT_ID.iam.gserviceaccount.com \
--duration=10m
The command prints a long URL. Send it to the customer. Treat it like a key while it is active, because anyone with the link can download that file.
Example 3: Load a Daily CSV File into BigQuery
Problem: The billing system exports a sales file each night, and the team wants to query it with SQL.
Solution: Use the bucket as a landing area. Upload the file first, then load it into a BigQuery table.
gcloud storage cp sales_2026-11-05.csv gs://shop-demo-files-2026/incoming/
bq load \
--source_format=CSV \
--skip_leading_rows=1 \
--autodetect \
shop.sales \
gs://shop-demo-files-2026/incoming/sales_2026-11-05.csv
Why not skip the bucket? Because the original file stays safe. If a load goes wrong, you can check the same file and run it again. To run this every night in the correct order, see our Google Cloud Workflows guide.
Example 4: Move Old Backups to a Cheaper Class Automatically
Problem: Backups pile up every day. Nobody opens the old ones, but they keep costing the Standard price.
Solution: Add a lifecycle rule and let Google do the housekeeping. Save this as lifecycle.json:
{
"lifecycle": {
"rule": [
{
"action": {"type": "SetStorageClass", "storageClass": "NEARLINE"},
"condition": {"age": 30, "matchesStorageClass": ["STANDARD"]}
},
{
"action": {"type": "SetStorageClass", "storageClass": "COLDLINE"},
"condition": {"age": 90, "matchesStorageClass": ["NEARLINE"]}
},
{
"action": {"type": "Delete"},
"condition": {"age": 365}
}
]
}
}
Now apply it to a bucket that holds only backups:
gcloud storage buckets update gs://shop-demo-backups-2026 \
--lifecycle-file=lifecycle.json
Files move to Nearline at 30 days and Coldline at 90 days. At 365 days, they are deleted. Be careful with that last rule. Do not apply it to a bucket that holds invoices or anything else you must keep, and test rules on sample data first.
Google Cloud Storage Pricing
The bill usually comes from four things: data stored, operations such as uploads, retrieval fees, and data downloaded over the network.
These are approximate list prices shown for the Iowa region. Mumbai and other regions can cost more or less, so check the official pricing page before you plan a budget.
| Class | Storage per GiB each month | Retrieval per GiB | 100 GiB for a month |
|---|---|---|---|
| Standard | $0.02 | $0 | $2.00 |
| Nearline | $0.01 | $0.01 | $1.00 |
| Coldline | $0.004 | $0.02 | $0.40 |
| Archive | $0.0012 | $0.05 | $0.12 |
The last column covers storage only. Archive looks cheap, but reading all 100 GiB would add $5 in retrieval fees, plus any network charges. That is why cold classes suit data you truly leave alone.
Free tier: Google offers 5 GB-months of Standard storage, 5,000 Class A operations and 50,000 Class B operations each month. This applies only in us-west1, us-central1 and us-east1, so a bucket in Mumbai does not qualify.
Watch out for early deletion: If you delete a Coldline file after 60 days, you still pay for the full 90-day minimum. Soft-deleted files also keep costing money until their retention period ends.
Google Cloud Storage Mistakes to Avoid
- Making a whole bucket public by accident: Keep public access prevention on unless the bucket really needs to be public.
- Putting private details in a bucket name: Bucket names are publicly visible, so never use a customer name or email address.
- Choosing the wrong location: Keep the bucket close to your users and to the services that read it. You also cannot rename a bucket later.
- Using Archive for active files: Low storage prices do not help if you read those files every week.
- Giving every app Storage Admin: Most apps only need to read or add objects. Pick the smallest role that works.
Conclusion
Google Cloud Storage gives your app a safe, shared place for files. Put your files in a private bucket, keep Standard as your default class, and move old data to a cheaper class when you are sure nobody needs it often.
Try it now: create one test bucket, upload a file, and download it back. It only takes a few minutes, and everything else in this guide will make more sense after that. For the full feature list, read the official Google Cloud Storage documentation.
FAQs
Q1: Is Google Cloud Storage free?
Not fully. It has a small monthly free tier in three US regions. Usage beyond that is charged, and buckets in Mumbai do not qualify.
Q2: What is the difference between GCS and Google Drive?
Google Drive is made for people sharing documents. GCS is made for apps, data pipelines and backups.
Q3: What is a GCS bucket?
A GCS bucket is a container that holds your files. Each file inside it is called an object.
Q4: Can I get a deleted file back from Google Cloud Storage?
Usually, yes. Soft delete keeps deleted files recoverable for seven days by default, unless someone changed or turned off that setting.
Q5: Is the Archive class in Google Cloud Storage slow?
No. Archive data is available within milliseconds. It is cheap to keep but costs more to read.
Q6: Should I store images in a database or Google Cloud Storage?
Store the image in a bucket and save its path in your database. Your database stays small, and files are easier to manage.