通过函数计算的Custom Runtime,您可以在函数计算平台使用Ruby来编写函数。本文介绍快速部署和调用Ruby函数的详细步骤。
前提条件
说明 如果您已安装Funcraft可直接跳转至步骤二:部署和调用函数。
步骤一:准备环境
安装Funcraft,最简单的方式就是直接下载可执行的二进制文件。
通过函数计算的Custom Runtime,您可以在函数计算平台使用Ruby来编写函数。本文介绍快速部署和调用Ruby函数的详细步骤。
安装Funcraft,最简单的方式就是直接下载可执行的二进制文件。
fun --version
检查安装是否成功。fun config
配置Funcraft。然后按照提示依次配置Account ID、Access Key ID、Access Key Secret、Default region name。fun config
Aliyun Account ID 1234xxx
Aliyun Access Key ID xxxx
Aliyun Access Key Secret xxxx
Default region name cn-xxxx
The timeout in seconds for each SDK client invoking 300
The maximum number of retries for each SDK client 5
Allow to anonynously report usage statistics to improve the tool over time? (Y/n)
git clone https://github.com/awesome-fc/fc-custom-demo
cd fc-custom-demo
cd ruby-demo
fun deploy -y
...
Waiting for service ruby-demo to be deployed...
Waiting for function fc-ruby to be deployed...
Waiting for packaging function fc-ruby code...
The function fc-ruby has been packaged. A total of 4 files were compressed and the final size was 1.45 KB
function fc-ruby deploy success
service ruby-demo deploy success
fun invoke -e "Hello World"
...
========= FC invoke Logs begin =========
FC Invoke Start RequestId: a9c4dc8a-4b5b-48e0-9a3f-70310531ae61
Hello World
FC Invoke End RequestId: a9c4dc8a-4b5b-48e0-9a3f-70310531ae61
Duration: 0.69 ms, Billed Duration: 100 ms, Memory Size: 512 MB, Max Memory Used: 5.06 MB
========= FC invoke Logs end =========
FC Invoke Result:
Hello World
在文档使用中是否遇到以下问题
更多建议
匿名提交