Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,14 @@ export const myDemoFunction = defineFunction({
entry: './path/to/handler.ts' // this path should either be absolute or relative to the current file
});
```

## `resourceGroupName`

By default, functions are grouped together in a resource group named `function`. You can override this to group related function with other Amplify resources like `auth`, `data`, `storage`, or separate them into your own custom group.
This is typically useful when you have resources that depend on each other and you want to group them together.

```ts title="amplify/functions/my-demo-function/resource.ts"
export const myDemoFunction = defineFunction({
resourceGroupName: 'data'
});
```
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export const postConfirmation = defineFunction({
// optionally define an environment variable for your group name
environment: {
GROUP_NAME: 'EVERYONE'
}
},
resourceGroupName: 'auth'
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import { defineFunction } from "@aws-amplify/backend"

export const createAuthChallenge = defineFunction({
name: "create-auth-challenge",
resourceGroupName: 'auth'
})
```

Expand Down Expand Up @@ -89,6 +90,7 @@ import { defineFunction } from "@aws-amplify/backend"

export const defineAuthChallenge = defineFunction({
name: "define-auth-challenge",
resourceGroupName: 'auth'
})
```

Expand Down Expand Up @@ -183,6 +185,7 @@ import { defineFunction, secret } from "@aws-amplify/backend"

export const verifyAuthChallengeResponse = defineFunction({
name: "verify-auth-challenge-response",
resourceGroupName: 'auth'
})
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { defineFunction } from '@aws-amplify/backend';

export const customMessage = defineFunction({
name: "custom-message",
resourceGroupName: 'auth'
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { defineFunction } from "@aws-amplify/backend";

export const myDynamoDBFunction = defineFunction({
name: "dynamoDB-function",
resourceGroupName: "data",
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { defineFunction } from "@aws-amplify/backend"

export const createAuthChallenge = defineFunction({
name: "create-auth-challenge",
resourceGroupName: 'auth'
})
```

Expand Down Expand Up @@ -79,6 +80,7 @@ import { defineFunction } from "@aws-amplify/backend"

export const defineAuthChallenge = defineFunction({
name: "define-auth-challenge",
resourceGroupName: 'auth'
})
```

Expand Down Expand Up @@ -144,6 +146,7 @@ export const verifyAuthChallengeResponse = defineFunction({
environment: {
GOOGLE_RECAPTCHA_SECRET_KEY: secret("GOOGLE_RECAPTCHA_SECRET_KEY"),
},
resourceGroupName: 'auth'
})
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { defineFunction } from '@aws-amplify/backend';

export const preTokenGeneration = defineFunction({
name: 'pre-token-generation',
resourceGroupName: 'auth'
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const storage = defineStorage({
triggers: {
onUpload: defineFunction({
entry: './on-upload-handler.ts'
resourceGroupName: 'storage',
})
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ To get started, create a new directory and a resource file, `amplify/auth/pre-si
import { defineFunction } from '@aws-amplify/backend';

export const preSignUp = defineFunction({
name: "pre-sign-up"
name: "pre-sign-up",
resourceGroupName: 'auth'
});
```

Expand Down
Loading