Build your first serverless function in 10 minutes
Tags: serverless, ibmcloud, beginners
Published: 2019-06-17 18:22:34

---
title: Build your first serverless function in 10 minutes
published: true
tags: serverless, ibmcloud, beginners
canonical_url: https://maxkatz.org/2019/06/13/build-your-first-serverless-function-in-10-minutes/
---

My teammate [Upkar Lidder](https://twitter.com/lidderupk) published a [great tutorial on how to create your first serverless function very fast](https://dev.to/lidderupk/another-simplest-serverless-function-but-seriously-4c7b)⚡️. I wanted to give it a try and share the step with you here. There is nothing to download, install or configure. You can finish this tutorial in under 10 minutes ⏳.

### Tutorial steps

You will complete the following steps:

1. Create a new IBM Cloud account or sign into an existing account
2. Create a new cloud functions
3. Test the function
4. Invoking as a REST API

Let’s go! 🏃🏻‍♀️🏃🏻‍♂️

### Sign-up for an IBM Cloud account

In this first step you will sign-up for a new account or log-in into an existing account.

![serverless-helloworld-signin](https://katzmax.files.wordpress.com/2019/06/serverless-helloworld-signin.png?w=1024&h=448)

1. [Sign-up](https://ibm.biz/BdzPSq) for an IBM Cloud account or [sign-in](https://ibm.biz/BdzPSq) into an existing account
  - You will get a completely free account where you can try and use cloud 40 services. You can keep it forever. That’s pretty nice!
2. That’s it

### Creating a cloud function

In this step you will create a new cloud function.

1. After you sign-in, open the = menu in the top-right and select **Functions**  
 ![serverless-helloworld-menu](https://katzmax.files.wordpress.com/2019/06/serverless-helloworld-menu-2.png?w=150&h=450)
2. From the **IBM Cloud Functions** main page click **Start Creating** button  
 ![serverless-helloworld-startcreating](https://katzmax.files.wordpress.com/2019/06/serverless-helloworld-startcreating.png?w=500&h=225)
3. From the **Create** page, select **Create Action** option  
 ![serverless-helloworld-createaction](https://katzmax.files.wordpress.com/2019/06/serverless-helloworld-createaction-1.png?w=501&h=264)
4. On the **Create Action** page
  - For **Action Name** enter _myfirstaction_
  - Keep default values for **Enclosing Package** and **Runtime  
 ![serverless-helloworld-actionname](https://katzmax.files.wordpress.com/2019/06/serverless-helloworld-actionname.png?w=500&h=194)**  
5. Click **Create** button to create the Serverless function

All done. You should see the function code now.

![serverless-helloworld-code](https://katzmax.files.wordpress.com/2019/06/serverless-helloworld-code.png?w=1024&h=452)

### Testing the function

In this step we will test the function.

1. To make it super simple, click the **Invoke** button (upper right). You are done.  
 ![serverless-hellowrold-invoke1](https://katzmax.files.wordpress.com/2019/06/serverless-hellowrold-invoke1.png?w=1024&h=305)

Now, to make it just a little bit more interesting, let’s make a super small change to the function.

1. Change the message the function returns to I _built this in 10 minutes!_
2. Click the **Save** button
3. Click the **Invoke** button. You should see the updated message 🤩
### Invoking as a REST API

In this last step you will learn how to invoke the function as a REST API.

1. On the left-hand side menu click **Endpoints**
2. In **Web Action** section, check **Enable as Web Action**. Click **Save  
 ![serverless-helloworld-webaction](https://katzmax.files.wordpress.com/2019/06/serverless-helloworld-webaction.png?w=1024&h=255)**  
3. Copy the URL below. Open a new browser window and paste the URL into the address bar
4. You should see the result from the function  
 ![serverless-hellowworld-browserrun](https://katzmax.files.wordpress.com/2019/06/serverless-hellowworld-browserrun.png?w=1024&h=263)

That’s it. It was fast, right?

### Summary

In this blog post you learned how to create your first serverless function. If you want to learn more and cover more advanced serverless topics, please check out the [serverless Code Patterns](https://ibm.biz/BdzPhz) we have available.