Vai al contenuto
⚠️ Warning: Extraordinary electrical maintenance – Scheduled shutdown of the Cloud garr-ct1 region (Catania) from 22 to 29 July 2025. For more details, please read the maintenance notice.

Tutorial rapido su s3cmd per Object Storage GARR

s3cmd è un client a riga cliomando libero per caricare, recuperare e gestire dati in Amazon S3 e altri provider di cloud storage che usano il protocollo S3, come GARR Object Storage. È un semplice programma a riga di comando che non richiede installazione o complicate configurazioni.

In questo breve tutorial assumiamo che tu voglia accedere a GARR Object Storage tramite protocollo S3.

Prima di tutto devi scaricare le credenziali EC2 per il tuo progetto e utente:

  • Accedi alla dashboard
  • Clicca sulla scheda Progetto -> Compute -> Accesso & Sicurezza
  • Clicca sulla scheda Credenziali API
  • Clicca sul pulsante Scarica Credenziali EC2

Il file scaricato ec2rc.sh contiene le variabili d'ambiente EC2_ACCESS_KEY e EC2_SECRET_KEY (e anche EC2_URL sebbene questo sarà ignorato nella configurazione seguente).

Installazione

Esegui il seguente comando dalla riga di comando:

$ sudo apt-get install s3cmd

Configurazione

Sulla tua macchina Linux client, ora puoi avviare s3cmd --configure e seguire le risposte evidenziate sotto (nota che per il parametro endpoint devi specificare l'URL appropriato per la tua regione cloud, vedi la tabella in fondo a questa pagina).

$ s3cmd --configure

Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.

Access Key: xxxxxxxxxxxxxxxxxx
Secret Key: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
Default Region [US]: 
S3 Endpoint [s3.amazonaws.com]: object-store.cloud.garr.it:8080
DNS-style bucket+hostname:port template for accessing a bucket [mybucket.object-store.cloud.garr.it:8080]: object-store.cloud.garr.it:8080
Encryption password: 
Path to GPG program [/usr/bin/gpg]: 
Use HTTPS protocol [No]: Yes
HTTP Proxy server name: 
HTTP Proxy server port:

New settings:
  Access Key: xxxxxxxxxxxxxxxxxx
  Secret Key: yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
  Default Region: US
  S3 Endpoint: object-store.cloud.garr.it:8080
  DNS-style bucket+hostname:port template for accessing a bucket: object-store.cloud.garr.it:8080
  Encryption password: 
  Path to GPG program: /usr/bin/gpg
  Use HTTPS protocol: True
  HTTP Proxy server name: 
  HTTP Proxy server port:

Test access with supplied credentials? [Y/n] Y
Please wait, attempting to list all buckets...
Success. Your access key and secret key worked fine :-)

Now verifying that encryption works...
Not configured. Never mind.

Save settings? [y/N] y
Configuration saved to '/home/user/.s3cfg'

Nota: non è necessario creare le regole dns per l'accesso ai bucket.

Utilizzo

Ora puoi usare il client s3cmd.

Crea un nuovo bucket:

s3cmd mb s3://mybucket

Elenca i bucket:

s3cmd ls

Copia un file locale nel bucket remoto:

s3cmd put FILE [FILE...] s3://mybucket

Elenca il contenuto del bucket remoto:

s3cmd ls s3://mybucket

Copia un file remoto in locale:

s3cmd get s3://mybucket/file LOCAL_FILE

Cancella un file remoto:

s3cmd del s3://mybucket/file

Cancella un bucket:

s3cmd rb s3://mybucket

Ulteriori dettagli sull'utilizzo sono disponibili su s3tools.org/usage

Regioni ed Endpoint

L'endpoint da usare dipende dalla regione Cloud GARR su cui è allocato il tuo progetto. Puoi trovare questa informazione sulla dashboard, in Compute -> Overview. A seconda della regione, usa il valore Endpoint corrispondente nella configurazione s3cmd.

Regione Endpoint
garr-pa1 object-store.cloud.garr.it:8080
garr-ct1 object-store.cloud.garr.it:8080