This page shows you how to upload objects from memory to your Cloud Storage bucket by using client libraries. Uploading from memory is useful for when you want to avoid unnecessary writes from memory to your local file system.
An uploaded object consists of the data you want to store along with any associated metadata. For a conceptual overview, including how to choose the optimal upload method based on your file size, see Uploads and downloads.
Required roles
To get the permissions that you need to upload objects from memory to a bucket,
ask your administrator to grant you the Storage Object User
(roles/storage.objectUser
) IAM role on the bucket. This
predefined role contains the permissions required to upload an object to a
bucket. To see the exact permissions that are required, expand the
Required permissions section:
Required permissions
storage.objects.create
storage.objects.delete
- This permission is only required for uploads that overwrite an existing object.
You can also get these permissions with custom roles.
For information about granting roles on buckets, see Use IAM with buckets.
Upload an object from memory
For more information, see the Cloud Storage C++ API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
For more information, see the Cloud Storage C# API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
For more information, see the Cloud Storage Go API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
For more information, see the Cloud Storage Java API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
For more information, see the Cloud Storage Node.js API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
For more information, see the Cloud Storage PHP API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
For more information, see the Cloud Storage Python API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
For more information, see the Cloud Storage Ruby API reference documentation.
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries.
What's next
- Learn about naming requirements for objects.
- List the objects that have been successfully uploaded to the bucket.
- Control who has access to your objects and buckets.