Write, debug, and save a version of a user-defined function in the Function Compute console.
Create a new Function 2.0
We recommend that you use Function 3.0 because Version 2.0 is no longer recommended. For more information about the differences, see Differences between 2.0 and 3.0. To create a Function 3.0 function, see Create a 3.0 function.
Log in to the Function Compute console. In the top menu bar, select a Region.

In the navigation pane on the left of the Service List page, click Create Service.
After the service is created, on the Function Management page, click Create Function.
On the Create Function page, select Create with Built-in Runtime and set Handler Type to Handle Event Requests. Configure other parameters as needed, and then click Create.

Next, test your function. For more information about the input parameter settings, see Write code for a custom parsing function. Click Test Function and verify that the function executes correctly and returns the expected data.
Enter the function code. For more information, see Write custom parsing function code.

You can also select Test Function > Configure Test Request. For more information about the input parameter settings, see Write custom parsing function code. Confirm that the function executes correctly and returns the expected data.

After the test is complete, click Deploy Code and verify that the code is deployed.
In the upper-right corner, click Publish Version. Enter a Description and click OK.

The system generates an auto-incrementing service version number. Make a note of the generated service version number because custom domain name parsing in HTTPDNS does not support the LATEST version of a function.
You have now configured the function in the FC 2.0 Function Compute console. You can add this function to a Function Compute policy in the HTTPDNS console.
For more information about how to apply the new Function Compute service to an HTTPDNS Function Compute policy, see Configure custom DNS resolution based on Function Compute.