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.
Prerequisites
ascli
, you must complete the following
requirements: - Deploy an HSTS operator in IBM Cloud Pak® for Integration. To deploy an Aspera HSTS operator in Cloud Pak for Integration, see Deploying HSTS using the OpenShift web console.
- Log in to the OpenShift Container Platform in the CLI (
oc login
) by using your admin credentials. If you do not already installed the OpenShift CLI, see Getting started with the OpenShift CLI. - Create an Aspera HSTS instance. To create an HSTS instance, see Create an HSTS service instance.
- Create and access key for your storage. See Creating access key for storage.
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"}}'
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.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 theID
value, andYOUR_SECRET
corresponds to thesecret
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