Manage Compute Environments

Before you can deploy a function or invoke a function from an org, you must create a compute environment. A compute environment in the Salesforce cloud represents a place where your deployed functions run. When you create a compute environment you specify an org that the compute environment is connected to. That org can then access and invoke functions deployed to that compute environment.

When developing a function, create compute environments associated with your sandbox or scratch orgs. When you're ready to deploy the function to production, create a compute environment associated with your production org and deploy your function to that compute environment.

To create a compute environment, use the sf env create compute command, specifying the org, and optionally an alias that you can use after the compute environment has been created:

To check which compute environments you've created, use the sf env list command:

If you no longer need a compute environment, or you wish to disconnect a connected org, use the sf env delete command with the compute environment alias to remove the compute environment:

Manage and set environment variables your function needs at runtime.