How create and upload content in Cloud Storage GCP?

🧰 Simple way to install SDK from GCP.

🔗Related content

You can find repo related in:

🐱‍🏍GitHub

You can connect with me in:

🧬LinkedIn

Resume 🧾

All this blog is using shell.

Using SDK’s Go…


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Lucas M. Ríos

🧰 Simple way to install SDK from GCP.

🔗Related content

You can find repo related in:

🐱‍🏍GitHub

You can connect with me in:

🧬LinkedIn

Resume 🧾

All this blog is using shell.

Using SDK's Google we will use tool to manage Cloud Storage. In this blog we will create a storage and upload content in it.

For more information and potential of this, click here.

Pre-Conditions:

  • You need have installed SDK. You can do that following next steps Note: I set alias to use SDK like msdk. ---

1st - Set a name to bucket ✍️

We assign to a variable the name that will have bucket.

I use following command:

BUCKET_NAME="xlmriosx_bucket"

2nd - Create bucket ✅

Using SDK installed with alias like msdk I use following command to create a bucket:

  • With alias:
mdsk gsutil mb -p $PROJECT_NAME -c $BUCKET_TYPE -l $REGION gs://$BUCKET_NAME
  • Without alias:
docker run --rm --volumes-from gcloud-config gcr.io/google.com/cloudsdktool/cloud-sdk gsutil mb -p $PROJECT_NAME -c $BUCKET_TYPE -l $REGION gs://$BUCKET_NAME

Where:
$PROJECT_NAME -> Is name of the project where you wnat instance a bucket.

$BUCKET_TYPE -> Is type of storage you want, like standard, nearline, coldline, archive.

$REGION -> Region where you want stay your storage bucket.

OUTPUT:

Creating gs://xlmriosx_bucket/...

3rd - Verify that your bucket was created ✅

We will list buckets to verify that our bucket was created:

  • With alias:
docker run -ti --name gcloud-config gcr.io/google.com/cloudsdktool/cloud-sdk gcloud auth login
  • Without alias:
msdk gsutil ls gs://$BUCKET_NAME

4th - Upload content in bucket ⬆️

We can copy content to bucket with the following command:

msdk gsutil cp $DATA gs://$BUCKET_NAME

OUTPUT:

Copying file:///$DATA
[Content-Type=X]...
- [1 files][    Y.0 B/    Y.0 B]
Operation completed over 1 objects/Y.0 B.

Where:
$DATA -> Directory or file that we want upload in the bucket.

5th - Say thanks, give like and share if this has been of help/interest 😁🖖


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Lucas M. Ríos


Print Share Comment Cite Upload Translate Updates
APA

Lucas M. Ríos | Sciencx (2023-02-09T21:46:44+00:00) How create and upload content in Cloud Storage GCP?. Retrieved from https://www.scien.cx/2023/02/09/how-create-and-upload-content-in-cloud-storage-gcp/

MLA
" » How create and upload content in Cloud Storage GCP?." Lucas M. Ríos | Sciencx - Thursday February 9, 2023, https://www.scien.cx/2023/02/09/how-create-and-upload-content-in-cloud-storage-gcp/
HARVARD
Lucas M. Ríos | Sciencx Thursday February 9, 2023 » How create and upload content in Cloud Storage GCP?., viewed ,<https://www.scien.cx/2023/02/09/how-create-and-upload-content-in-cloud-storage-gcp/>
VANCOUVER
Lucas M. Ríos | Sciencx - » How create and upload content in Cloud Storage GCP?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/02/09/how-create-and-upload-content-in-cloud-storage-gcp/
CHICAGO
" » How create and upload content in Cloud Storage GCP?." Lucas M. Ríos | Sciencx - Accessed . https://www.scien.cx/2023/02/09/how-create-and-upload-content-in-cloud-storage-gcp/
IEEE
" » How create and upload content in Cloud Storage GCP?." Lucas M. Ríos | Sciencx [Online]. Available: https://www.scien.cx/2023/02/09/how-create-and-upload-content-in-cloud-storage-gcp/. [Accessed: ]
rf:citation
» How create and upload content in Cloud Storage GCP? | Lucas M. Ríos | Sciencx | https://www.scien.cx/2023/02/09/how-create-and-upload-content-in-cloud-storage-gcp/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.