Skip to content

Commit 2f1a163

Browse files
authored
adds resourceGroupName to function docs (#8140)
* add resourceGroupName
1 parent dce8c9a commit 2f1a163

File tree

9 files changed

+25
-2
lines changed

9 files changed

+25
-2
lines changed

src/pages/[platform]/build-a-backend/functions/configure-functions/index.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,14 @@ export const myDemoFunction = defineFunction({
9090
entry: './path/to/handler.ts' // this path should either be absolute or relative to the current file
9191
});
9292
```
93+
94+
## `resourceGroupName`
95+
96+
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.
97+
This is typically useful when you have resources that depend on each other and you want to group them together.
98+
99+
```ts title="amplify/functions/my-demo-function/resource.ts"
100+
export const myDemoFunction = defineFunction({
101+
resourceGroupName: 'data'
102+
});
103+
```

src/pages/[platform]/build-a-backend/functions/examples/add-user-to-group/index.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ export const postConfirmation = defineFunction({
5353
// optionally define an environment variable for your group name
5454
environment: {
5555
GROUP_NAME: 'EVERYONE'
56-
}
56+
},
57+
resourceGroupName: 'auth'
5758
});
5859
```
5960

src/pages/[platform]/build-a-backend/functions/examples/custom-auth-flows/index.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import { defineFunction } from "@aws-amplify/backend"
5353

5454
export const createAuthChallenge = defineFunction({
5555
name: "create-auth-challenge",
56+
resourceGroupName: 'auth'
5657
})
5758
```
5859

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

9091
export const defineAuthChallenge = defineFunction({
9192
name: "define-auth-challenge",
93+
resourceGroupName: 'auth'
9294
})
9395
```
9496

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

184186
export const verifyAuthChallengeResponse = defineFunction({
185187
name: "verify-auth-challenge-response",
188+
resourceGroupName: 'auth'
186189
})
187190
```
188191

src/pages/[platform]/build-a-backend/functions/examples/custom-message/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import { defineFunction } from '@aws-amplify/backend';
4545

4646
export const customMessage = defineFunction({
4747
name: "custom-message",
48+
resourceGroupName: 'auth'
4849
});
4950
```
5051

src/pages/[platform]/build-a-backend/functions/examples/dynamo-db-stream/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { defineFunction } from "@aws-amplify/backend";
4646

4747
export const myDynamoDBFunction = defineFunction({
4848
name: "dynamoDB-function",
49+
resourceGroupName: "data",
4950
});
5051
```
5152

src/pages/[platform]/build-a-backend/functions/examples/google-recaptcha-challenge/index.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import { defineFunction } from "@aws-amplify/backend"
4444

4545
export const createAuthChallenge = defineFunction({
4646
name: "create-auth-challenge",
47+
resourceGroupName: 'auth'
4748
})
4849
```
4950

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

8081
export const defineAuthChallenge = defineFunction({
8182
name: "define-auth-challenge",
83+
resourceGroupName: 'auth'
8284
})
8385
```
8486

@@ -144,6 +146,7 @@ export const verifyAuthChallengeResponse = defineFunction({
144146
environment: {
145147
GOOGLE_RECAPTCHA_SECRET_KEY: secret("GOOGLE_RECAPTCHA_SECRET_KEY"),
146148
},
149+
resourceGroupName: 'auth'
147150
})
148151
```
149152

src/pages/[platform]/build-a-backend/functions/examples/override-token/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import { defineFunction } from '@aws-amplify/backend';
4545

4646
export const preTokenGeneration = defineFunction({
4747
name: 'pre-token-generation',
48+
resourceGroupName: 'auth'
4849
});
4950
```
5051

src/pages/[platform]/build-a-backend/functions/examples/s3-upload-confirmation/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export const storage = defineStorage({
4747
triggers: {
4848
onUpload: defineFunction({
4949
entry: './on-upload-handler.ts'
50+
resourceGroupName: 'storage',
5051
})
5152
}
5253
});

src/pages/[platform]/build-a-backend/functions/examples/user-attribute-validation/index.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ To get started, create a new directory and a resource file, `amplify/auth/pre-si
3737
import { defineFunction } from '@aws-amplify/backend';
3838

3939
export const preSignUp = defineFunction({
40-
name: "pre-sign-up"
40+
name: "pre-sign-up",
41+
resourceGroupName: 'auth'
4142
});
4243
```
4344

0 commit comments

Comments
 (0)