**Summary:**
Moving from IBM Cloud Functions to IBM Code Engine involves considering various factors such as HTTP endpoint needs, programming language, processing time, required libraries, and parallel processing. IBM Cloud Code Engine offers apps, jobs, and functions to cater to different business logic. This article provides tips and tricks for working with Code Engine functions, including local testing, hybrid job and function approaches, and utilizing Code Engine-injected environment variables for API design.
Moving from IBM Cloud Functions to IBM Code Engine involves considering various factors such as HTTP endpoint needs, programming language, processing time, required libraries, and parallel processing. IBM Cloud Code Engine offers apps, jobs, and functions to cater to different business logic. This article provides tips and tricks for working with Code Engine functions, including local testing, hybrid job and function approaches, and utilizing Code Engine-injected environment variables for API design.
**How to Migrate from IBM Cloud Functions to IBM Code Engine**
When migrating off IBM Cloud Functions, IBM Cloud Code Engine is one of the possible deployment targets. Code Engine offers apps, jobs, and functions. IBM Cloud Code Engine is a fully managed, serverless platform for containerized workloads. In 2021, Code Engine added support for functions. The article discusses the options on how to move from IBM Cloud Functions to Code Engine, focusing on the characteristics of apps, jobs, and functions. It also provides tips and tricks for working with Code Engine functions, such as local testing, hybrid job and function approaches, and utilizing Code Engine-injected environment variables for API design.
**FAQ:**
1. **What are the different ways to run business logic in IBM Cloud Code Engine?**
IBM Cloud Code Engine features three different ways to run business logic: apps, jobs, and functions.
2. **What are the characteristics that help distinguish between apps, jobs, and functions in IBM Cloud Code Engine?**
Apps are suitable for creating REST APIs or deploying web applications with backend/frontend functionality, jobs are long-running processes that do not require user interaction, and functions react to incoming HTTP requests very quickly, serving low-latency use cases.
3. **How can I test functions locally in IBM Cloud Code Engine?**
Functions can be tested locally by using a wrapper code and maintaining files with test configurations as JSON objects similar to what is passed by Code Engine to the function on invocation.
4. **What is the hybrid approach for utilizing the HTTP endpoint of a function and the potentially longer execution time of a job in IBM Cloud Code Engine?**
In the hybrid approach, both a function and a job are created, and the Code Engine API is utilized to create a job run from within the function. This allows the function to be called via its HTTP endpoint, and then it terminates after kicking off the job run.
5. **How can I utilize Code Engine-injected environment variables for API design in IBM Cloud Code Engine?**
Code Engine-injected environment variables like `__ce_path` and `__ce_method` can be used to serve multiple API functions from the same Code Engine function by switching on the supplied values for these variables.
6. **What are the considerations when moving from IBM Cloud Functions to IBM Code Engine?**
Considerations include the need for an HTTP endpoint to invoke the code, processing triggered by an event, programming language used, required libraries, processing time, compute resources needed, and whether parallel processing is desired. The guide “Migrating IBM Cloud Functions to Code Engine” provides a detailed overview to help select the best entity for the existing workload.
7. **Where can I find additional information about IBM Cloud Code Engine?**
Additional information about IBM Cloud Code Engine can be found in the IBM Cloud Code Engine documentation to get started on IBM’s official website.