My teammate Upkar Lidder published a great tutorial on how to create your first serverless function very fast⚡️. 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:
- Create a new IBM Cloud account or sign into an existing account
- Create a new cloud functions
- Test the function
- 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.
-
Sign-up for an IBM Cloud account or sign-in 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!
- That’s it
Creating a cloud function
In this step you will create a new cloud function.
- After you sign-in, open the = menu in the top-right and select Functions
- From the IBM Cloud Functions main page click Start Creating button
- From the Create page, select Create Action option
- On the Create Action page
- For Action Name enter myfirstaction
- Keep default values for Enclosing Package and Runtime
- Click Create button to create the Serverless function
All done. You should see the function code now.
Testing the function
In this step we will test the function.
- To make it super simple, click the Invoke button (upper right). You are done.
Now, to make it just a little bit more interesting, let’s make a super small change to the function.
- Change the message the function returns to I built this in 10 minutes!
- Click the Save button
- 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.
- On the left-hand side menu click Endpoints
- In Web Action section, check Enable as Web Action. Click Save
- Copy the URL below. Open a new browser window and paste the URL into the address bar
- You should see the result from the function
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 we have available.
Top comments (0)