Understanding Resumable Upload in Google Cloud Storage and cURL example.

GCP Resumable Upload
  • HTTP 200/201: These response codes means that you upload is complete and you sent all bytes.
  • HTTP 308: This response code means that you upload is not complete and you must send more bytes to finish the upload. Note that you’ll receive a range header stating the byte offset that you already sent.
  • HTTP 499: This response code means that you deleted a Resumable Upload successfully.
  • HTTP 500/503: These response codes means that your upload was interrupted and you must continue the upload. In this case, you must check the upload status (I’ll show bellow)
  • A GCP Account
  • The gsutil tool installed
  • The cURL installed
  • One GCP Storage Bucket created
  1. Go to your GCP Console, create a Service Account and Create New Key (JSON Format) and download this key. In my case, I added this account as owner, but you must be conscious of “The least privilege
Service account and keys
Account activated
themediumarticle bucket
  • “gsutil signurl”: gsutil command and signurl action
  • “-c text/plain”: content type for the signed url
  • “-m RESUMABLE”: to define that upload is a Resumable Upload
  • “my-auth.json”: your service account key file. You can omit it, but I like to include it in every request, so I can control the account that I’m using.
  • “gs://themediumarticle/example-file.txt”: the bucket name and the object name (file name).
Location header value
HTTP 200 response code.
The bucket object was created.
range header



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Leandro Damascena

Leandro Damascena

Systems architect and developer for over 15 years and passionate about cloud solutions. I have been working with cloud solutions for over 10 years!