This topic describes how to use faascmd commands.
Prerequisites
faascmd is configured. For more information, see Configure faascmd.
Before you use the authorization command, make sure that the following requirements are met:
- An Object Storage Service (OSS) bucket is created for FPGA as a Service (FaaS) to upload the compiled DCP file.
- A folder named compiling_logs is created in the bucket.
Background information
Description of the faascmd command syntax:
- All commands and parameters provided by faascmd are case-sensitive.
- In faascmd commands, extra spaces are not allowed between parameters,
equal signs (=)
, or values.
This topic describes the following faascmd commands:
- Grant permissions to a RAM user
- View an authorization policy
- Delete an authorization policy
- View all objects in an OSS bucket
- Upload an compiled file
- Download an object from an OSS bucket
- Create an FPGA image
- View FPGA images
- Delete FPGA images
- Download an FPGA image
- View the download progress of an FPGA image
- Publish an FPGA image
- Query information of FPGA-accelerated instances
Grant permissions to a RAM user
You can run the faascmd auth
command to authorize a RAM user to access your OSS buckets as a FaaS administrator.
faascmd auth --bucket=<YourFaasOSSBucketName>

View an authorization policy
You can run the faascmd list_policy
command to check whether the specified OSS bucket is added in the authorization policy
(faasPolicy).
faascmd list_policy

Delete an authorization policy
You can run the faascmd delete_policy
command to delete an authorization policy (faasPolicy).
faascmd delete_policy

View all objects in an OSS bucket
You can run the faascmd list_objects
command to view all objects in an OSS bucket.
faascmd list_objects

grep
command to filter objects. Example: faascmd list_objects | grep "xxx"
.
Upload an compiled file
You can run the faascmd upload_object
command to upload original copies of files compiled on your local PC to a specified
OSS bucket.
faascmd upload_object --object=<NewFileNameInOSSBucket> --file=<YourFilePath>/<FileNameYouWantToUpload>

- If the file that you want to upload is stored in the current directory, you do not need to specify a path.
- The locally compiled original files provided by Intel FPGA are in the .gbs format. The locally compiled original files provided by Xilinx FPGA are compressed as packages in the .tar format after script processing.
Download an object from an OSS bucket
You can run the faascmd get_object
command to download the specified object from an OSS bucket.
faascmd get_object --object=<YourObjectName> --file=<YourLocalPath>/<YourFileName>

Create an FPGA image
You can run the faascmd create_image
command to submit a request to create an FPGA image. If the request succeeds, FpgaImageUUID
is returned.
faascmd create_image --object=<YourObjectName>
--fpgatype=<intel/xilinx> --encrypted=<true/false>
--kmskey=<key/If encrypted is set to true, this parameter is required. Otherwise, this parameter is optional.>
--shell=<Shell Version/Required> --name=<name/Optional>
--description=<description/Optional> --tags=<tags/Optional>

View FPGA images
You can run the faascmd list_images
command to view the information of all FPGA images that you create.
faascmd list_images

Delete FPGA images
You can run the faascmd delete_image
command to delete an FPGA image.
faascmd delete_image --imageuuid=<yourImageuuid>

Download an FPGA image
You can run the faascmd download_image
command to submit a request to download an FPGA image.
faascmd download_image --instanceId=<YourInstanceId>
--fpgauuid=<Yourfpgauuid> --fpgatype=<intel/xilinx>
--imageuuid=<YourImageuuid> --imagetype=<afu>
--shell=<YourImageShellVersion>
faascmd download_image --instanceId=XXXXX --fpgauuid=XXXX --fpgatype=intel --imageuuid=XXXX
View the download progress of an FPGA image
You can run the faascmd fpga_status
command to view the status of the current FPGA board card or the download progress
of the FPGA image.
faascmd fpga_status --fpgauuid=<Yourfpgauuid> --instanceId=<YourInstanceId>

Publish an FPGA image
You can run the faascmd publish_image
command to submit a request to publish an FPGA image.
faascmd publish_image --imageuuid=<YourImageuuid> --imageid=<YourInstanceImageid>
- imageuuid specifies the ID of the FPGA image that you want to publish to Alibaba Cloud Marketplace.
You can run the
faascmd list_images
command to view this image ID. - imageid specifies the image ID of the current FPGA-accelerated instance. You can go to the product details page in the ECS console to view the image ID.
Query information of FPGA-accelerated instances
You can run the faascmd list_instances
command to query the basic information of an FPGA-accelerated instance. This information
includes the instance ID, FPGA board card information, and shell version.
faascmd list_instances --instanceId=<YourInstanceId>
