Based Serverless quickly build database applications in .NET Core

First introduced in several important concepts under article appears:

Function calculates (Function Compute): function calculates is an event-driven service, by computing function, users need to manage the operation of the servers, just write code and upload. Function calculates ready to computing resources, and is elastically stretchable run user code, and users only need to pay according to the actual code that runs resources consumed. More information function calculation reference

This article will focus on how quickly the function computes build a .NET Core database applications.

Subscribe to a service

  1. Free open function calculation , pay by volume, has a great function to calculate free credit.

Quick Start

1. Install the latest version of Fun
2. Clone project to local

3. The deployment function computing and cloud resources to the cloud database

  • The implementation of the project root directory cd fc-db/rds-mysql
  • Run make buildfinished its construction
  • run fun package
  • Run fun deploy --use-ros --stack-name fc-dbdeployment

Note Because the database instance will produce some of the costs, so make sure there is balance in the account before you run. Of course, in order to save users money, we chose the smallest amount by example, the cost of the MySQL database is ¥ 0.236 / hour, after the experience complete, it is recommended to ROS console to delete all instances of cloud resources.
4. After the completion of the deployment, by make invoke_dotnetcorecalling function Drive

$ make invoke_dotnetcore

using template: template.yml
========= FC invoke Logs begin =========
FC Initialize Start RequestId: b3a3c027-2355-4e74-8944-6e90bedbe180
表创建成功!
FC Initialize End RequestId: b3a3c027-2355-4e74-8944-6e90bedbe180
FC Invoke Start RequestId: b3a3c027-2355-4e74-8944-6e90bedbe180
数据插入成功!
FC Invoke End RequestId: b3a3c027-2355-4e74-8944-6e90bedbe180

Duration: 35.10 ms, Billed Duration: 100 ms, Memory Size: 512 MB, Max Memory Used: 35.28 MB
========= FC invoke Logs end =========

FC Invoke Result:
 csharp

to sum up

Based on function calculation services to build a simple database application for creating tables and insert data. By Fun , a key deployment tool function calculation and other appropriate cloud resources, eliminating the steps to the multi-platform.

Related reference

  1. Function calculates
  2. Aliyun Serverless VSCode 插件
  3. Fun

Reference Example

  1. fc-db

Guess you like

Origin yq.aliyun.com/articles/744453