Lessons in this course (9)

3. Cloud Storage

Basic★ Must knowLesson 3 of 9

Object storage in buckets (globally unique names), classes Standard, Nearline (≥30 days), Coldline (≥90 days), Archive (≥365 days); Autoclass moves objects automatically; lifecycle rules; object versioning; signed URLs for temporary access; uniform bucket-level access with IAM; encryption by default (Google-managed or customer-managed keys in Cloud KMS).

csharp
var storage = await StorageClient.CreateAsync();                 // credentials from the service account automatically
await using var file = File.OpenRead(path);
await storage.UploadObjectAsync("shop-uploads-prod", $"invoices/{id}.pdf", "application/pdf", file);
var signer = UrlSigner.FromCredential(await GoogleCredential.GetApplicationDefaultAsync());
string url = await signer.SignAsync("shop-uploads-prod", $"invoices/{id}.pdf", TimeSpan.FromMinutes(15));