Search This Blog

Thursday, July 20, 2023

s3cmd to access Google Cloud Storage Bucket

Step1:

Installing s3cmd on Redhat Linux 7

 

$ yum install wget

$ wget https://sourceforge.net/projects/s3tools/files/s3cmd/2.2.0/s3cmd-2.2.0.tar.gz

$ yum install unzip

$ tar -xvf s3cmd-2.2.0.tar.gz

$ cd s3cmd-2.2.0

$ yum install python3

$ sudo python3 setup.py install

 

Step2:

Create a Storage Bucket

 

Step3:

Create the HMAC Key using URL: https://cloud.google.com/storage/docs/authentication/managing-hmackeys#console

 

 

test-storage-connectivity@playground-s-11-c77a0584.iam.gserviceaccount.com

Access key: GOOG1EGAHS#############UYFGTXNJPEE4LKSFQ

Secret:        e5bDpZeUFb#########357bV0dssTOHpMTtZ

 

Make Sure the service account is having "Storage Bucket Creator" Permission

 

Step4:

Configure the s3cmd

 

$ s3cmd --configure

 

 

New settings:

  Access Key: GOOG1EGAHS#############UYFGTXNJPEE4LKSFQ

  Secret Key: e5bDpZeUFb#########357bV0dssTOHpMTtZ

  Default Region: US

  S3 Endpoint: https://storage.googleapis.com

  DNS-style bucket+hostname:port template for accessing a bucket: y

  Encryption password:

  Path to GPG program: /usr/bin/gpg

  Use HTTPS protocol: True

  HTTP Proxy server name:

  HTTP Proxy server port: 0

 

Do not test the connectivity, just save the configuration

 

Step5:

Upload the file.

[root@testvm tmp]# s3cmd put ./test.txt s3://xyzcbucket-celumpub/test.txt

upload: './test.txt' -> 's3://fanlocbucket-celumpub/test.txt'  [1 of 1]

0 of 0     0% in    0s     0.00 B/s  done