In this article
Cloud Storage is Google Cloud's object storage. You use it to keep files such as images, backups, logs and datasets.
Quick summary
- Files are called objects and they live in buckets.
- Bucket names are globally unique.
- You choose a location and a storage class when you create a bucket.
- You can work in the console or with
gcloud storage.
Buckets and objects
A bucket is a top-level container. An object is a file plus its metadata. There are no real folders, but names with slashes, like images/logo.png, look like folders in the console.
Bucket names
Names must be unique across all of Google Cloud, so my-bucket is almost certainly taken. A good trick in labs is to include your project ID in the name.
Storage classes
| Class | Best for |
|---|---|
| Standard | Data you use often |
| Nearline | Data you read about once a month |
| Coldline | Data you read about once a quarter |
| Archive | Long-term backups you rarely read |
Colder classes cost less to store but more to read, and have a minimum storage time. Check the official pricing page before you decide.
Locations
You can store data in one region, in a dual-region, or across a multi-region. Closer to your users means lower delay. Multi-region gives more availability.
Commands
gcloud storage buckets create gs://YOUR_UNIQUE_BUCKET --location=us-central1
gcloud storage cp photo.jpg gs://YOUR_UNIQUE_BUCKET/
gcloud storage ls gs://YOUR_UNIQUE_BUCKET
gcloud storage rm gs://YOUR_UNIQUE_BUCKET/photo.jpg
Access control
Use IAM roles to decide who can read or write. Uniform bucket-level access keeps permissions in one place instead of per object. Do not make a bucket public unless you really want everyone to read it.
Tips for labs
- If creating a bucket fails with "name already exists", add a unique suffix.
- Make sure the region matches the lab instructions.
- Run commands in the lab's project. See projects explained.
Storage appears in many skill badges, so these basics earn points faster. Track yours in the calculator.
Frequently asked questions
Can I rename a bucket?
No. Create a new bucket with the name you want and copy the objects across.
Does Cloud Storage have real folders?
No. Names with slashes only look like folders in the console.
Should I put secrets in a bucket name?
No. Bucket names are global and can appear in URLs, so never put private information in them.