Installing the CLI and plug-in
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.
IBM Cloud® Functions offers a powerful plug-in for the IBM Cloud CLI that allows complete management of the Cloud Functions system. You can use the Cloud Functions CLI plug-in to manage your code snippets in actions, create triggers and rules to enable your actions to respond to events, and bundle actions into packages.
Setting up the IBM Cloud CLI
Install the latest version of the IBM Cloud CLI.
Before you begin
You must create an IBM Cloud account.
-
Download and install the IBM Cloud CLI.
-
Log in to the IBM Cloud CLI.
ibmcloud login
-
If you have more than one account, you are prompted to select which account to use. Follow the prompts or use the
target
command to select your IBM Cloud account.ibmcloud target -c <account_id>
-
You must also specify a region. You can use the
target
command to target or change regions.ibmcloud target -r <region>
-
You must specify a resource group. To get a list of your resource groups, run the following command.
ibmcloud resource groups
Example output
Retrieving all resource groups under account <account_name> as email@ibm.com... OK Name ID Default Group State default a8a12accd63b437bbd6d58fb8b462ca7 true ACTIVE test a8a12abbbd63b437cca6d58fb8b462ca7 false ACTIVE
-
Target a resource group by running the following command.
ibmcloud target -g <resource_group>
Example output
Targeted resource group default
Setting up the Cloud Functions CLI plug-in
To work with Cloud Functions, download and install the CLI plug-in.
You can use the Cloud Functions CLI plug-in to perform the following tasks.
- Run your code snippets, or actions, on Cloud Functions. See Creating and invoking actions.
- Create triggers and rules to enable your actions to respond to events. See Creating triggers and rules.
- Bundle actions and configure external events sources. See Create and use packages.
- Explore the catalog of packages and enhance your applications with external services. See Adding IBM Cloud.
Complete the following steps to install the Cloud Functions CLI plug-in
-
Install the Cloud Functions plug-in.
ibmcloud plugin install cloud-functions
-
Verify that the plug-in is installed.
ibmcloud plugin list
Example Output
Plugin Name Version cloud-functions/wsk/functions/fn 1.0.32
-
All Cloud Functions commands begin with
ibmcloud fn
. To see everything that you can do with the Cloud Functions plug-in, runibmcloud fn
with no arguments.ibmcloud fn
For more information about Cloud Functions commands, see the Cloud Functions CLI reference.
Next steps for IBM Cloud® Functions CLI
To work with Cloud Functions entities, you must first create or target a namespace. For more information, see Managing namespaces.
Updating the Cloud Functions CLI plug-in
You might want to update the CLI periodically to use new features.
-
View your current plug-in list by running
ibmcloud plugin list
command.ibmcloud plugin list
Example Output
Plugin Name Version Status cloud-functions/wsk/functions/fn 1.0.35 Update Available cloud-object-storage 1.1.0 container-registry 0.1.437 container-service/kubernetes-service 0.4.51
-
If an update is available, run the
ibmcloud plugin update
command.ibmcloud plugin update cloud-functions
Configuring the Cloud Functions CLI to use an HTTPS proxy
The Cloud Functions CLI can be set up to use an HTTPS proxy. To set up an HTTPS proxy, an environment variable that is called HTTPS_PROXY
must be created. The variable must be set to the address of the HTTPS proxy, and its port
by using the following format: {PROXY IP}:{PROXY PORT}
.
Changing the name of the org
or space
creates a new namespace based on the changed name. The entities in the old namespace are not visible in the new namespace and might be deleted.
Migrating from OpenWhisk CLI to Cloud Functions CLI plug-in
You can now use the Cloud Functions CLI plug-in to interact with Cloud Functions entities. Although you can continue to use the stand-alone OpenWhisk CLI, it does not have the latest features that are supported by Cloud Functions, such as IAM-based
namespaces and service bind
.
Command syntax
All the command options and arguments for commands in the Cloud Functions CLI plug-in are the same as the options for the OpenWhisk stand-alone CLI with the following differences.
- The IBM Cloud® Functions plug-in automatically utilizes your current login and target information.
wsk
commands are now run asibmcloud fn
.- The
wsk ibmcloud login
command is no longer needed. You can sign in by usingibmcloud login
command. - You can manage your APIs by using the
ibmcloud fn api
commands.
For more information, see the Cloud Functions CLI reference.
API Authentication and Host
With the Cloud Functions CLI plug-in, you don't need to explicitly configure the API key and API host. Instead, you can log in with the ibmcloud login
command. You can target an IAM-enabled namespace or Cloud Foundry-based namespace
by running ibmcloud fn property set --namespace <namespace_name_or_ID>
. After you log in, all commands begin with ibmcloud fn
.
Migrating deployment scripts
If you have scripts that use the OpenWhisk CLI with the wsk
commands, all commands work the same way by using the command ibmcloud fn
. You can modify your scripts to use the IBM Cloud
CLI plug-in, or create an alias or wrapper so that current commands that use wsk
are translated to ibmcloud fn
. The ibmcloud login
and ibmcloud target
commands in the IBM Cloud CLI work in unattended mode. With unattended mode, you can configure your environment before you run ibmcloud fn
commands to deploy and manage your Cloud Functions entities.