Transferring files from the command line

You can use the Aspera command line interface (ascli) to enter commands to upload or download files to HSTS. This topic shares the procedures that are needed for enabling ascli, then explains how to transfer files.

Note: To transfer files, if your network configuration provides public IP addresses for worker nodes, you do not need to install Aspera Proxy. In all other cases, Aspera Proxy must be used to allow transfers from clients to the HSTS instance. External traffic must be routed to the reverse proxy instance, which then routes it to the appropriate HSTS services. For more information see Using Aspera Proxy with HSTS.

Prerequisites

Before you can transfer files by using ascli, you must complete the following requirements:

Installing the Aspera CLI (ascli)

The Aspera CLI is an open source command line that can interact with HSTS on CP4I. You can use it as a Node API client and as a means to transfer from a local machine into your HSTS on CP4I.

For installation and configuration, see https://github.com/IBM/aspera-cli.

Configuring ascli for your HSTS

Ascli requires the URL and the credentials of the Node API. This can be retrieved by the OpenShift web console (Getting credentials for High-Speed Transfer Server), or by using the command line.

The following steps are using the command line, where INSTANCE_NAME is quickstart, and NAMESPACE is aspera-ns.

  • Retrieve your user, password, and host by running the following commands.
    NODE_USER=$(oc get secrets $INSTANCE_NAME-asperanoded-admin -n $NAMESPACE -o jsonpath='{.data.user}' | sed "s/\"//g" | base64 --decode)
    NODE_PASS=$(oc get secrets $INSTANCE_NAME-asperanoded-admin -n aspera-ns -o jsonpath='{.data.pass}' | sed "s/\"//g" | base64 --decode)
    NODE_HOST=$(oc get route -l name=http-proxy,app.kubernetes.io/managed-by=ibm-aspera-hsts,cr.namespace=$NAMESPACE -n $NAMESPACE -o jsonpath='{.items[*].spec.host}')

Creating access key for storage

To enable a transfer to your storage, create an access key and secret to grant access to your storage. Specify the information of your storage type in the payload by running the following command:

curl -ik -u "$NODE_USER:$NODE_PASS" https://$NODE_HOST:443/access_keys -X POST -d '{"storage":{"type":"local","path":"/data"}}'
Note: The payload assumes that you have a Posix compliant storage with a directory at path /data.
The command output contains the value for the access key ID and the Secret that are automatically generated (store them according to your local security practices). Alternatively, instead of generating random values for the ID and secret, you can specify your own values in the payload.

Transferring files with HSTS

You can use the ascli node upload command to upload files. The following procedure describes the steps that you must follow to upload files by using your OpenShift cluster and the ascli, including the syntax that you must use.
Note: To download files, replace the value upload with the value download in the command line.
  • Transfer files by using ascli. For example,
    ascli node upload --username=ACCESS_KEY --password=YOUR_SECRET --url=YOUR_URL --token-type=YOUR_TOKEN_TYPE /path/to/test/file
  • Example with expanded syntax,
    ascli node upload --username=asp_user --password=asp_pass --url=https://hstscluster.ibm.com --token-type=basic /path/to/test/file

    The ACCESS_KEY corresponds to the ID value, and YOUR_SECRET corresponds to the secret in the output of the payload file.

To upload or download files by using the command line, you must use the syntax for ascli:

# ascli node upload <OPTIONS>

 Required options:
  --url=VALUE                  URL of application, e.g. https://org.asperafiles.com
  --username=VALUE             username to log in
  --password=VALUE             user's password
  --validator=VALUE            identifier of validator (optional for central)
  --asperabrowserurl=VALUE     URL for simple aspera web ui
  --sync-name=VALUE            sync name
  --token-type=ENUM            Type of token used for transfers: aspera, basic, hybrid