DEV Community

Afzaal Ahmad Zeeshan
Afzaal Ahmad Zeeshan

Posted on

Funcraft: Alibaba Cloud Function Compute Development Kit

Almost every cloud platform offers their own unique development kits. Alibaba Cloud provides several options to develop and deploy the serverless workloads. In the past, I have mainly used the in-portal deployment options; for the smaller functions I even write the code in-line. As the project grows and becomes cumbersome, it's better to find an SDK that offers a proper development environment. An IDE, if you may.

Setting up

The Funcraft by Alibaba Cloud is a free and open source SDK that you can use to develop the functions and test them locally on your device. All you would need to install is Docker and the Funcraft (@alicloud/fun) package from NPM repositories. The Docker engine is needed to run and debug the functions locally. If you do not wish to run the serverless on your machine, then you won't require this.

Installation of Docker is simple, and takes only a few minutes. Alibaba Cloud provides the documentation using which you can deploy Docker on your own machine for development purposes. Plus, it saves a lot of costs from your Alibaba Cloud budget.

First Function

Once you have the Funcraft set up, I recommend using the Alibaba Cloud Serverless extension for Visual Studio Code. This extension contains several support and utility methods that you can use to create, develop, debug and deploy the serverless instances.

You can use the credentials from your Alibaba Cloud Account Management to setup the Funcraft as well as the Alibaba Cloud CLI. You would need to use this to deploy the functions on the cloud platform. VS Code would use the RAM accounts from Alibaba Cloud.

You can perform several operations using the VS Code extension:

  1. Preview all the resources and their regions.
  2. Edit the resources.
  3. Create new resources (serverless, for example) in the regions you want to create them.
  4. Run and debug the resources as needed.
  5. Get support (such as autocomplete, etc.) based on the runtime/framework selected.
  6. Deploy the resources to the cloud.

On top of this, since the extension is closely integrated with the VS Code, you receive language autocompletion and syntax highlights and formatting too.

The extension creates the serverless in your local machine. Since it is a file in a folder, you can version control the serverless as well.

Deployment

From Visual Studio Code, you can deploy the serverless instances directly to the cloud.

Have you configured the credentials already? Select Bind New Account under Remote Resources tab to link your Alibaba Cloud to the extension.

To deploy, just click on the Deploy button in the Local Resources tab, this should deploy the services and functions (a service contains functions, for more on this, please check the Alibaba Cloud documentation)

Conclusion

In short, the Alibaba Cloud Serverless extension and the Funcraft are a very easy way to develop and deploy enterprise grade serverless resources. Both the products are free and open source, and you can try our the Alibaba Cloud Function Compute product free of cost (for development purposes).

That's about it for this one, I hope you learned something new about Alibaba Cloud Function Compute. :)

Top comments (0)