×
Community Blog Run a Serverless “Hello World!” on Alibaba Cloud

Run a Serverless “Hello World!” on Alibaba Cloud

This article explains how to run a serverless “Hello World!” application on Alibaba Cloud.

By Pablo Puig

What Is Serverless Computing?

Serverless Computing is a stable, elastically scaled, pay-as-you-go platform that is fully managed and all event-driven. The user can focus on writing the code without managing all the platform infrastructure underneath it, such as servers and hypervisors. The best part is Alibaba Cloud's serverless computing service, Function Compute, is free. It also offers an extremely large amount of throughput with up to one MILLION invocations and 400,000 CU per second compute resources each month. There is no database and no processing of large files. It is all event-driven computing and excellent for batch.

What Is an Event?

Anything that triggers Alibaba Cloud Function Compute to execute is regarded by the framework as an event. Events are platform events on Alibaba Cloud Function Compute, such as an HTTP Trigger, REST API, OSS event, and more. The ultimate goal of Function Compute is to transform the events into cloud resources or actions.

What Is a Service?

A service is an individual unit for this framework, such as a project file in a vast application. Most importantly, it is where you define the functions you are creating, the resources for those functions, the code, and the triggers. Plugins play a huge part in the actions of services as well.

Running a Serverless “Hello World!” Application

The following step-by-step guide explains how to run a serverless “Hello World!” application on Alibaba Cloud. You will get a basic understanding of the Function Compute service using the Alibaba Cloud console.

1

  • Step 2: Choose the region where you would like to create the function:

2

  • Step 3: Click Services and Functions and create a service. In my case, I'm going to select the German region:

3

  • Step 4: Add the Service Name and the Description. Specifying a Log Config is critical, so you can see the activity of the service once you invoke the function. Therefore, enable Bind Log and click Next.

Note: The Region will be selected automatically; make sure you don't skip Step 2 of this guide.

4

  • Step 5: Now, you have to choose your desired Creation Method for your function. You can choose Event Function, HTTP Function, or Function Template. In my case, I'm going to choose Event Function. Then, click Next.

5

  • Step 6: To configure your function, you have to enter a Function Name, the Runtime, the Instance Type, the Function Handler, the Memory, and the Timeout. In my case, I'm going to left everything at default. Then, click Next.

6

  • Step 7: Your function has been created. Click your newly created function and navigate to the Code section. Now, click Invoke to invoke your function and run the serverless Hello World application.

Note: Alternatively, you can create a trigger on the Triggers section to invoke your function based on events automatically.

7

  • Step 8: The execution of your function is successful. You can see your results in the Summary section, including request id, duration, billing duration, max memory usage, memory, and status. Additionally, you can see that Logs were created and stored.

8

Demo

0 0 0
Share on

Alibaba Cloud Community

39 posts | 3 followers

You may also like

Comments

Alibaba Cloud Community

39 posts | 3 followers

Related Products