fbpx

Concepts

Environment

An environment is a configuration group that contains actual Functions. The environment contains metadata about the functions compute preference such as Eligible Cloud Providers and compute geographical locations (e.g us-east, us-west, Europe, APAC, etc..), as well as cost and performance strategies such as least-expensive, compute location or highest-performance locations (based on network and compute latency).

The functions underneath the environment share similar characteristics and are managed as a consolidated group to some extent.

Application

The application is a logical frame that groups several environments of the same relevance. Commonly, it stores environments that share the same business application such as testing and production of a specific function.

For example, Application ‘WebApp”:

Function

Function is the user code and metadata. Spotinst supports growing number of programming languages (a.k.a Runtimes) to meet the industry standard and enable code diversity and flexibility. Each function is supplied by its metadata, that enforces specific characteristics of runtime type, requested memory and invocation timeout.

After creating a function, the service generates a URL that can be called countlessly and scales automatically from a few requests per day to thousands per second.

Please note: function initial invocation can occasionally take longer due to the concept of ‘cold’ start. In contrast to ‘warm’ container, where the user code is already injected in the runtime and ready to be used, ‘cold’ container start must allocate the container and inject the code.

Function invocation

For every invocation of the Function, the Function will have a request object that contains the query and the body. The Function should return a response object that should follow this structure

{
    statusCode: 200/4xx/5xx,
    body: “{\"text\":\"Hello\"}”,
    headers: {“Content-Type”: “application/json}
}

Please note: The body should be of type "string". If you want to return a JSON object as the response, simply add the "Content-Type”: “application/json" header.