Skip to content

Commit

Permalink
Add callouts for backend-function configuration not supported in cust…
Browse files Browse the repository at this point in the history
…om functions (#8210)
  • Loading branch information
Amplifiyer authored Jan 22, 2025
1 parent 9dd6a7e commit bd81c5c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export function getStaticProps() {

Amplify offers the ability to add layers to your functions which contain your library dependencies. Lambda layers allow you to separate your function code from its dependencies, enabling easier management of shared components across multiple functions and reducing deployment package sizes.

<Callout info>

**Note:** Configuring or adding layers in `defineFunction` is not supported for [Custom Functions](/[platform]/build-a-backend/functions/custom-functions/).

</Callout>

To add a Lambda layer to your function, follow these steps:

1. First, create and set up your Lambda layer in AWS. You can do this through the AWS Console or using the AWS CLI. For guidance on creating layers, refer to the [AWS documentation on creating Lambda layers](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html#configuration-layers-create).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export function getStaticProps() {

`defineFunction` comes out-of-the-box with sensible but minimal defaults. The following options are provided to tweak the function configuration.

<Callout info>

**Note:** The following options are not supported for [Custom Functions](/[platform]/build-a-backend/functions/custom-functions/) except for `resourceGroupName`.

</Callout>

## `name`

By default, functions are named based on the directory the `defineFunction` call is placed in. In the above example, defining the function in `amplify/functions/my-demo-function/resource.ts` will cause the function to be named `my-demo-function` by default.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ AWS Amplify Gen 2 functions are AWS Lambda functions that can be used to perform

</Callout>

<Callout info>

**Note:** [Environment variables and secrets](/[platform]/build-a-backend/functions/environment-variables-and-secrets/), [scheduling configuration](/[platform]/build-a-backend/functions/scheduling-functions/), [lambda layers](/[platform]/build-a-backend/functions/add-lambda-layers/) and [functions-options](/[platform]/build-a-backend/functions/configure-functions/) in `defineFunction` are not supported for Custom Functions. You can specify these configurations directly in your CDK Function definition.

</Callout>

In this guide, you will learn how to create Python and Go functions with Amplify functions. The examples shown in this guide do not use Docker to build functions. Instead, the examples use commands that run on your host system to build, and as such require the necessary tooling for the language you are using for your functions.

## Python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ Amplify Functions support setting environment variables and secrets on the `envi

</Callout>

<Callout info>

**Note:** Environment variables and secrets configuration in `defineFunction` is not supported for [Custom Functions](/[platform]/build-a-backend/functions/custom-functions/).

</Callout>

## Environment variables

Environment variables can be configured in `defineFunction` using the `environment` property.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export function getStaticProps() {

Amplify offers the ability to schedule Functions to run on specific intervals using natural language or [cron expressions](https://en.wikipedia.org/wiki/Cron). To get started, specify the `schedule` property in `defineFunction`:

<Callout info>

**Note:** Configuring the schedule in `defineFunction` is not supported for [Custom Functions](/[platform]/build-a-backend/functions/custom-functions/).

</Callout>

```ts title="amplify/jobs/weekly-digest/resource.ts"
import { defineFunction } from "@aws-amplify/backend";

Expand Down

0 comments on commit bd81c5c

Please sign in to comment.