Getting started with IBM Cloud Functions
IBM Cloud® Functions is deprecated. Existing Functions entities such as actions, triggers, or sequences will continue to run, but as of 28 December 2023, you can’t create new Functions entities. Existing Functions entities are supported until October 2024. Any Functions entities that still exist on that date will be deleted. For more information, see Deprecation overview.
If you’re an existing IBM Cloud® Functions user, you can continue to use the service until it is no longer supported in October 2024.
With IBM Cloud® Functions, you can use your favorite programming language to write lightweight code that runs app logic in a scalable way. You can run code in response to HTTP-based API requests from applications or run code in response to IBM Cloud services and third-party events. The Function-as-a-Service (FaaS) programming platform is based on the open source project Apache OpenWhisk.
As a result of the Cloud Foundry service deprecation, Cloud Foundry-based namespaces in Cloud Functions are deprecated and will stop working on Oct 31st, 2023. If you are still using Cloud-Foundry-based namespaces, migrate your namespace to an IAM namespace to ensure that your Cloud Function workloads continue to run.
Working with actions
With IBM Cloud® Functions, you can create stateless code snippets, called actions, that are set to perform one specific task. To learn more about actions and other Functions terms, see terminology.
Click an option to get started.
Creating an action in the console
To get started with Cloud Functions, try creating the Hello World quick start template.
-
Create an IBM Cloud account or log in to an existing account.
-
Navigate to the Cloud Functions dashboard.
-
Select a namespace.
-
Click Start Creating > Quickstart Templates and select the Hello World template.
-
Create a package for your action by entering a unique name in the Package Name field.
-
Select a runtime for your action. You can preview the code for the sample action in each available runtime before you deploy the template.
-
Click Deploy. You created an action. Great job!
-
Run the action by clicking Invoke. Invoking an action manually runs the app logic that the action defines. In the Activations panel, you can see the "Hello stranger!" greeting produced by the action.
-
Optional: Click Change Input to change the action or try your own.
a. Paste the following code into the Change Input box and change the name value.
{ "name": "xxxx" }
b. Then, click Invoke to run the action with your updates. The result is shown in the Activations panel. You can repeat this process as many times as you like.
Good work! You created your first action. To clean up this action, click the overflow menu and select Delete Action.
Creating an action in the CLI
Get up and running quickly with the Hello World JavaScript example code. This example creates a basic hello
action, which you can manually invoke to run its app logic.
What's next in Cloud Functions?
So you completed your first template deployment, where do you go from here?
- Become familiar with the terminology.
- Get started with your own actions.
- Learn about organizing actions in packages.