|
|
Cloud Storage
Author: Venkata Sudhakar
Google Cloud Storage is a unified object storage service for developers and enterprises. It offers worldwide storage and retrieval of any amount of data at any time, from simple website hosting to mobile apps to data analytics.
Storage Classes:
1. Standard - Best for frequently accessed data and short-term storage.
2. Nearline - Low cost for data accessed less than once a month.
3. Coldline - Very low cost for data accessed less than once a quarter.
4. Archive - Lowest cost for data accessed less than once a year.
The below example shows how to upload, download, and list objects in a Cloud Storage bucket using the Java client library.
It gives the following output,
Bucket created: my-gcp-bucket-1704067200000
Object uploaded: hello.txt
Downloaded content: Hello from Google Cloud Storage!
Objects in bucket:
- hello.txt
Key gsutil Commands:
gsutil mb gs://bucket-name - Create a new bucket.
gsutil cp file.txt gs://bucket-name/ - Upload a file.
gsutil cp gs://bucket-name/file.txt . - Download a file.
gsutil ls gs://bucket-name/ - List objects in a bucket.
gsutil rm gs://bucket-name/file.txt - Delete an object.
|
|