Arbutus object storage clients/fr: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
(Created page with "=== Configuration === Pour configurer l’outil <code>s3cmd</code>, lancez la commande")
No edit summary
Tag: Manual revert
 
(67 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<languages />
<languages />


Nous décrivons ici la configuration et l’utilisation de deux clients souvent employés pour le stockage objet sur Arbutus, s3cmd et WinSCP. Pour plus d’information sur le stockage, voyez la page [[Arbutus_Object_Storage/fr|Stockage objet sur Arbutus]].
Pour l'information sur comment obtenir de l'espace de stockage objet sur Arbutus, voir  [[Arbutus object storage/fr|cette page wiki]]. Voyez aussi l'information sur les clients&nbsp;:
* [[Accessing object storage with s3cmd/fr| Stockage objet : Accès avec s3cmd]]
* [[Accessing object storage with WinSCP/fr| Stockage objet : Accès avec WinSCP]]
* [[Accessing the Arbutus object storage with AWS CLI/fr| Stockage objet : Accès avec AWS CLI]]


Il faut noter que la solution de stockage objet sur Arbutus n'utilise pas l’approche [https://documentation.help/s3-dg-20060301/VirtualHosting.html S3 Virtual Hosting] d’Amazon avec des buckets DNS, contrairement à s3cmd et WinSCP qui l’offrent par défaut.
Il faut noter que la solution de stockage objet sur Arbutus n'utilise pas l’approche [https://documentation.help/s3-dg-20060301/VirtualHosting.html S3 Virtual Hosting] d’Amazon avec des buckets DNS, contrairement à ces clients qui l’offrent par défaut. Pour ne pas utiliser cette approche, il faut donc configurer les clients en conséquence.  


== s3cmd ==
[[Category:Cloud]]
=== Installation ===
Dépendant de votre distribution Linux, la commande <code>s3cmd</code> peut être installée avec les commandes <code>yum</code> (RHEL, CentOS) ou <code>apt</code (Debian, Ubuntu) suivantes :
 
<code>$ sudo yum install s3cmd</code><br/>
<code>$ sudo apt install s3cmd </code>
 
=== Configuration ===
Pour configurer l’outil <code>s3cmd</code>, lancez la commande
 
And make the following configurations with the keys provided by the Arbutus team:
<pre>
Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.
 
Access key and Secret key are your identifiers for Amazon S3. Leave them empty for using the env variables.
Access Key []: 20_DIGIT_ACCESS_KEY
Secret Key []: 40_DIGIT_SECRET_KEY
Default Region [US]:
 
Use "s3.amazonaws.com" for S3 Endpoint and not modify it to the target Amazon S3.
S3 Endpoint []: object-arbutus.cloud.computecanada.ca
 
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 []: object-arbutus.cloud.computecanada.ca
 
Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password []: PASSWORD
Path to GPG program []: /usr/bin/gpg
 
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 []: Yes
 
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:
</pre>
 
=== Create buckets ===
The next task is to make a bucket.  Buckets contain files. Bucket names must be unique across the Arbutus object storage solution.  Therefore, you will need to create a uniquely named bucket which will not conflict with other users.  For example, buckets <tt>s3://test/</tt> and <tt>s3://data/</tt> are likely already taken.  Consider creating buckets reflective of your project, for example <tt>s3://def-test-bucket1</tt> or <tt>s3://atlas_project_bucket</tt>.  Valid bucket names may only use the upper case characters, lower case characters, digits, periods, hyphens, and underscores (i.e. A-Z, a-z, 0-9, ., -, and _ ).
 
To create a bucket, use the tool's <code>mb</code> (make bucket) command:
 
<code>$ s3cmd mb s3://BUCKET_NAME/</code>
 
To see the status of a bucket, use the <code>info</code> command:
 
<code>$ s3cmd info s3://BUCKET_NAME/</code>
 
The output will look something like this:
 
<pre>
s3://BUCKET_NAME/ (bucket):
  Location:  default
  Payer:    BucketOwner
  Expiration Rule: none
  Policy:    none
  CORS:      none
  ACL:      *anon*: READ
  ACL:      USER: FULL_CONTROL
  URL:      http://object-arbutus.cloud.computecanada.ca/BUCKET_NAME/
</pre>
 
=== Upload files ===
To upload a file to the bucket, use the <code>put</code> command similar to this:
 
<code>$ s3cmd put --guess-mime-type FILE_NAME.dat s3://BUCKET_NAME/FILE_NAME.dat</code>
 
Where the bucket name and the file name are specified.  Multipurpose Internet Mail Extensions (MIME) is a mechanism for handling files based on their type. The <code>--guess-mime-type</code> command parameter will guess the MIME type based on the file extension.  The default MIME type is <code>binary/octet-stream</code>.
 
=== Delete File ===
To delete a file from the bucket, use the  <code>rm</code> command similar to this:<br/>
<code>$ s3cmd rm s3://BUCKET_NAME/FILE_NAME.dat</code>
 
=== ACLs and Policies ===
Buckets can have Access Control Lists (ACLs) and policies which govern who can access what resources in the object store.  These features are quite sophisticated.  Here are two simple examples of using ACLs using the tool's <code>setacl</code> command.
 
<code>$ s3cmd setacl --acl-public -r s3://BUCKET_NAME/</code>
 
The result of this command is that the public can access the bucket and recursively (-r) every file in the bucket.  Files can be accessed via URLs such as<br/>
<code><nowiki>https://object-arbutus.cloud.computecanada.ca/BUCKET_NAME/FILE_NAME.dat</nowiki></code>
 
The second ACL example limits access to the bucket to only the owner:
 
<code>$ s3cmd setacl --acl-private s3://BUCKET_NAME/</code>
 
Other more sophisticated examples can be found in the s3cmd [https://www.s3express.com/help/help.html help site] or s3cmd(1) man page.
 
== WinSCP ==
 
=== Installing WinSCP ===
WinSCP can be installed from https://winscp.net/.
 
=== Configuring WinSCP ===
Under "New Session", make the following configurations:
<ul>
<li>File protocol: Amazon S3</li>
<li>Host name: object-arbutus.cloud.computecanada.ca</li>
<li>Port number: 443</li>
<li>Access key ID: 20_DIGIT_ACCESS_KEY provided by the Arbutus team</li>
</ul>
and "Save" these settings as shown below
 
[[File:WinSCP Configuration.png|600px|thumb|center|WinSCP configuration screen]]
 
Next, click on the "Edit" button and then click on "Advanced..." and navigate to "Environment" to "S3" to "Protocol options" to "URL style:" which <b>must</b> changed from "Virtual Host" to "Path" as shown below:
 
[[File:WinSCP Path Configuration.png|600px|thumb|center|WinSCP Path Configuration]]
 
This "Path" setting is important, otherwise WinSCP will not work and you will see hostname resolution errors, like this:
[[File:WinSCP resolve error.png|400px|thumb|center|WinSCP resolve error]]
 
=== Using WinSCP ===
Click on the "Login" button and use the WinSCP GUI to create buckets and to transfer files:
 
[[File:WinSCP transfers.png|800px|thumb|center|WinSCP file transfer screen]]
 
=== ACLs and Policies ===
Unfortunately, as of version 5.19 WinSCP is not capable of managing object storage ACLs or Policies.
 
[[Category:CC-Cloud]]

Latest revision as of 15:28, 21 June 2024

Other languages:

Pour l'information sur comment obtenir de l'espace de stockage objet sur Arbutus, voir cette page wiki. Voyez aussi l'information sur les clients :

Il faut noter que la solution de stockage objet sur Arbutus n'utilise pas l’approche S3 Virtual Hosting d’Amazon avec des buckets DNS, contrairement à ces clients qui l’offrent par défaut. Pour ne pas utiliser cette approche, il faut donc configurer les clients en conséquence.