GCP

GCS(Google Cloud Storage)

misankim 2023. 5. 12. 23:22

GCS(Google Cloud Storage)

 

 

# google cloud storage

-> Same as s3 in aws

 

 

# Bucket storage class and s3 storage class

 

Standard - Standard

Nearline - Standard-Infrequent Access

Coldline - One Zone-Infrequent Access

Archive - Glacier

 

 

# gsutil

-> cli command for google cloud storage

-> Installed together with cloud SDK installation

 

 

# Command example

 

Check bucket list

gsutil list

 

Check the object list in the bucket

 

gsutil ls gs://premisan-test/

 

Copy object to bucket

 

gsutil cp pink-flowers-on-trees-981364.jpg gs://premisan-test/

 

Check object details in a bucket

 

gsutil ls -L gs://premisan-test/pink-flowers-on-trees-981364.jpg

 

Deleting objects in a bucket

 

gsutil rm gs://premisan-test/pink-flowers-on-trees-981364.jpg

 

Check bucket capacity

 

gsutil du -sh gs://premisan-test/

 

Create bucket

 

gsutil mb gs://버킷_이름

 

Delete Bucket

 

gsutil rb gs://버킷_이름

 

 

# Bucket/Directory Sync

 

Sync

gsutil rsync test123 gs://premisan-test/test123

 

Sync to subdirectories

 

gsutil rsync -r test123 gs://premisan-test/test123

 

multi-threaded sink

 

 gsutil -m rsync -r test123 gs://premisan-test/test123

 

Sync by deleting files that do not match.

 

gsutil rsync -d -r gs://premisan-test/test123 my-test123

 

Sync by deleting unmatched files (dry-run)

gsutil rsync -d -r -n gs://premisan-test/test123 my-test123

 

Sync data between buckets

 

gsutil -m rsync -r -d gs://premisan-test/test123 gs://my-test-bucket

 

Sink data from cloud storage bucket to aws s3 bucket

 gsutil rsync -d -r gs://my-gs-bucket s3://my-s3-bucket