> For the complete documentation index, see [llms.txt](https://docs.codemash.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.codemash.io/cloud/code/functions/new.md).

# Create a custom function

Write a new serverless function.

**Where:** Code → Functions → New · `/projects/<project>/code/functions/custom/new`

The **Add New Function** screen creates a function on your connected serverless provider. A radio choice at the top picks how you create it:

* **AWS SAM CLI** — "Use AWS SAM (Serverless Application Model) CLI to create a function." The screen shows a step-by-step guide with copyable snippets: `Create function` starters for NodeJs, NodeJs + TS, Python, .NET, Go, Ruby, and Java, a `template.yaml` and `samconfig.toml` example, then `sam build` and `sam deploy`.
* **Manual upload** — "Upload zip file with function code manually." A form with these fields:

{% hint style="info" %}
Screenshot TODO — capture comes from testing-plan area **11-code**.
{% endhint %}

## Fields (Manual upload)

* **Cloud provider** (required) — the [code integration](/cloud/code/integrations.md) the function deploys to.
* **Runtime** (required) — an AWS Lambda runtime; check **Include previous generation runtimes** to also list older ones.
* **Handler** (required) — the entry point; the placeholder and hint change with the selected runtime (default example: `input.handler`).
* **Memory in MB** (required) — e.g. `128`.
* **Timeout in minutes** / **Timeout in seconds** (required) — e.g. `0` / `15`.
* **Environment variables** — key–value pairs passed to the function.
* **Impersonate Service Account** — run the function under a Service Account's identity and access rights.
* Code package — **Download** a minimal NodeJS 20.x template for a quick start, then upload a `.zip` file (max 10 MB; a new upload overwrites the existing code).
* **Display name** — e.g. `Create invoice for customer`.
* **Function description** — e.g. `Generates invoice for customer`.
* **Tags** — free labels for filtering.
* **Enabled** — whether the function can be called.

**Cancel** returns to the [Functions list](/cloud/code/functions.md); **Save** submits the form.

{% hint style="danger" %}
The V2 backend no longer exposes standalone code-function endpoints (the concept moved into code integrations and marketplace bindings), so **Save** on this legacy screen is currently a stub — it does not create a function. Use the [Marketplace](/cloud/code/marketplace.md) to add callable functions today.
{% endhint %}

## Use it from code

[Code](/sdks-and-cli/code.md) — functions can also be called from [triggers](/other-topics/triggers.md) (the `code` action) or on a schedule.

## API reference

Endpoints: [Code](/api-reference/code.md).
