Wie greife ich mit s3cmd (Linux) auf EO Data und Objektspeicher zu?

Zugriff auf EO Data mit s3cmd (Linux)

Achtung

Ihre virtuelle Maschine muss im Projekt mit EO DATA gestartet werden!

Sie können s3cmd mit Python Pip oder aus dem Linux-Repository installieren.

Installation aus dem System-Repository auf Debian/Ubuntu-Systemen:

Prüfen Sie auf Aktualisierungen:

$ sudo apt update

Installation von s3cmd aus dem Repository:

$ sudo apt install s3cmd

Installation aus dem Python-Repository (auf den meisten Linux-Distributionen mit vorinstalliertem Python und Pip):

Installation mit PIP:

Prüfen Sie, ob Sie Pip installiert haben

$ pip

The program 'pip' is currently not installed. To run 'pip' please ask your administrator to install the package 'python-pip'

Falls nicht installiert (Ubuntu):

$ sudo apt install python-pip

$ pip --version

pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)

$ sudo pip install s3cmd

Wenn Sie das Folgende sehen:

Traceback (most recent call last):
File "/usr/bin/pip", line 11, in <module>
sys.exit(main())
File "/usr/lib/python2.7/dist-packages/pip/init.py", line 215, in main
locale.setlocale(locale.LC_ALL, '')
File "/usr/lib/python2.7/locale.py", line 581, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

fügen Sie die folgende Zeile

export LC_ALL=en_US.UTF-8

zu dieser Datei hinzu:

~/.profile

Jetzt können Sie .profile überprüfen:

$ cat ~/.profile
export LC_ALL=en_US.UTF-8
$ source ~/.profile
$ s3cmd --version
s3cmd version 2.0.1

Konfigurieren Sie s3cmd

$ s3cmd --configure

Geben Sie neue Werte ein oder übernehmen Sie die Standardwerte in Klammern mit Enter.

Eine detaillierte Beschreibung aller Optionen finden Sie im Benutzerhandbuch.

Für den Zugriff auf Amazon S3 benötigen Sie Ihren Access und Secret Key. Lassen Sie diese leer, um die Voreinstellungen zu nutzen.

Access Key [access]:<ENTER>
Secret Key [access]:<ENTER>
Default Region [RegionOne]: <ENTER>
Use "s3.amazonaws.com" for S3 Endpoint and not modify it to the target Amazon S3.
S3 Endpoint [eodata.cloudferro.com:] <ENTER>
Use "%(bucket)s.s3.amazonaws.com" to the target Amazon S3. "%(bucket)s" and "%(location)s" vars can be used
if the target S3 system supports dns based buckets.
DNS-style bucket+hostname:port template for accessing a bucket [%(bucket)s.s3.amazonaws.com]:  <ENTER>
Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password: <ENTER>
Path to GPG program [/usr/bin/gpg]: <ENTER>
When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP, and can only be proxied with Python 2.7 or newer
Use HTTPS protocol [No]: <ENTER>
On some networks all internet access must go through a HTTP proxy.
Try setting it here if you can't connect to S3 directly
HTTP Proxy server name: <ENTER>

New settings:

       Access Key: access
       Secret Key: access
       Default Region: RegionOne
       S3 Endpoint: eodata.cloudferro.com
       DNS-style bucket+hostname:port template for accessing a bucket: %(bucket)s.s3.amazonaws.com
       Encryption password:
       Path to GPG program: /usr/bin/gpg
       Use HTTPS protocol: False
       HTTP Proxy server name: _____
       HTTP Proxy server port: 0

     Test access with supplied credentials? [Y/n] <ENTER>
     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 <ENTER>
     Configuration saved to '/home/eouser/.s3cfg'

Nun können Sie s3cmd-Befehle verwenden (weitere Informationen zu s3cmd: http://s3tools.org/usage)

$ s3cmd ls

2017-12-11 15:30  s3://DIAS
2017-12-11 15:30  s3://EOCLOUD
2017-12-11 15:30  s3://EODATA

$ s3cmd ls s3://EODATA/

                       DIR   s3://EODATA/Envisat/
                       DIR   s3://EODATA/Landsat-5/
                       DIR   s3://EODATA/Landsat-7/
                       DIR   s3://EODATA/Landsat-8/
                       DIR   s3://EODATA/Sentinel-1/
                       DIR   s3://EODATA/Sentinel-2/
                       DIR   s3://EODATA/Sentinel-3/
                       DIR   s3://EODATA/Sentinel-5P/

Um über s3cmd Zugriff auf Object Storage-Buckets zu erhalten, müssen Sie zunächst Ihre eigenen ec2-Zugangsdaten mit diesem Tutorial erstellen.

Nach der Erstellung der Anmeldeinformationen löschen Sie bitte die Datei .s3cfg im Home-Ordner und konfigurieren Sie s3cmd durch diese Eingabe neu:

s3cmd --configure

Nutzen Sie folgende Werte:

New settings:
Access Key: (your EC2 credentials)
Secret Key: (your EC2 credentials)
Default Region: none
S3 Endpoint: https://s3.fra1-1.cloudferro.com
DNS-style bucket+hostname:port template for accessing a bucket: https://s3.fra1-1.cloudferro.com
Encryption password: (your password)
Path to GPG program: /usr/bin/gpg
Use HTTPS protocol: True
HTTP Proxy server name:
HTTP Proxy server port: 0

Nach diesem Vorgang sollte es Ihnen möglich sein, Ihren Objektspeicher anzuzeigen und darauf zuzugreifen.