Skip to content

Commit 0f91569

Browse files
adjust headings, add heading before examples for better linking
1 parent 517e3e8 commit 0f91569

File tree

1 file changed

+16
-14
lines changed
  • src/pages/[platform]/build-a-backend/storage/use-with-custom-s3

1 file changed

+16
-14
lines changed

src/pages/[platform]/build-a-backend/storage/use-with-custom-s3/index.mdx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,24 +78,26 @@ You can refer to [Amazon S3's Policies and Permissions documentation](https://do
7878
In order to make calls to your manually configured S3 bucket from your application, you must also set up a [CORS Policy](/[platform]/build-a-backend/storage/extend-s3-resources/#for-manually-configured-s3-resources) for the bucket.
7979
</Callout>
8080

81-
### Specify S3 bucket in Amplify's backend config
81+
### Specify the S3 bucket in Amplify's backend config
8282

8383
Next, use the `addOutput` method from the backend definition object to define a custom S3 bucket by specifying the name and region of the bucket in your `amplify/backend.ts` file. You must also set up the appropriate resources and IAM policies to be attached to the backend.
8484

8585
<Callout>
8686
**Important:** You can use a storage backend configured through Amplify and a custom S3 bucket at the same time using this method. However, the Amplify-configured storage will be used as the **default bucket** and the custom S3 bucket will only be used as an additional bucket.
8787
</Callout>
8888

89+
#### Configure the S3 bucket
90+
8991
Below are several examples of configuring the backend to define a custom S3 bucket:
9092

9193
<BlockSwitcher>
9294
<Block name="Guest Users">
9395
Below is an example of expanding the original backend object to grant all guest (i.e. not signed in) users read access to files under `public/`:
9496

9597
```ts title="amplify/backend.ts"
96-
import { defineBackend } from '@aws-amplify/backend';
97-
import { Effect, Policy, PolicyStatement } from 'aws-cdk-lib/aws-iam';
98-
import { Bucket } from 'aws-cdk-lib/aws-s3';
98+
import { defineBackend } from "@aws-amplify/backend";
99+
import { Effect, Policy, PolicyStatement } from "aws-cdk-lib/aws-iam";
100+
import { Bucket } from "aws-cdk-lib/aws-s3";
99101
import { auth } from "./auth/resource";
100102

101103
const backend = defineBackend({
@@ -172,9 +174,9 @@ backend.auth.resources.unauthenticatedUserIamRole.attachInlinePolicy(
172174
<Block name="Authenticated Users">
173175
Below is an example of expanding the original backend object to grant all authenticated (i.e. signed in) users with full access to files under `public/`:
174176
```ts title="amplify/backend.ts"
175-
import { defineBackend } from '@aws-amplify/backend';
176-
import { Effect, Policy, PolicyStatement } from 'aws-cdk-lib/aws-iam';
177-
import { Bucket } from 'aws-cdk-lib/aws-s3';
177+
import { defineBackend } from "@aws-amplify/backend";
178+
import { Effect, Policy, PolicyStatement } from "aws-cdk-lib/aws-iam";
179+
import { Bucket } from "aws-cdk-lib/aws-s3";
178180
import { auth } from "./auth/resource";
179181

180182
const backend = defineBackend({
@@ -253,10 +255,10 @@ backend.auth.resources.authenticatedUserIamRole.attachInlinePolicy(authPolicy);
253255
Below is an example of expanding the original backend object with user group permissions. Here, any authenticated users can read from `admin/` and `public/` and authenticated users belonging to the "admin" user group can only manage `admin/`:
254256
{/* cSpell:disable */}
255257
```ts title="amplify/backend.ts"
256-
import { defineBackend } from '@aws-amplify/backend';
257-
import { Effect, Policy, PolicyStatement } from 'aws-cdk-lib/aws-iam';
258-
import { Bucket } from 'aws-cdk-lib/aws-s3';
259-
import { auth } from './auth/resource';
258+
import { defineBackend } from "@aws-amplify/backend";
259+
import { Effect, Policy, PolicyStatement } from "aws-cdk-lib/aws-iam";
260+
import { Bucket } from "aws-cdk-lib/aws-s3";
261+
import { auth } from "./auth/resource";
260262

261263
const backend = defineBackend({
262264
auth,
@@ -346,9 +348,9 @@ Below is an example of expanding the original backend object to define read acce
346348

347349
{/* cSpell:disable */}
348350
```ts title="amplify/backend.ts"
349-
import { defineBackend } from '@aws-amplify/backend';
350-
import { Effect, Policy, PolicyStatement } from 'aws-cdk-lib/aws-iam';
351-
import { Bucket } from 'aws-cdk-lib/aws-s3';
351+
import { defineBackend } from "@aws-amplify/backend";
352+
import { Effect, Policy, PolicyStatement } from "aws-cdk-lib/aws-iam";
353+
import { Bucket } from "aws-cdk-lib/aws-s3";
352354
import { auth } from "./auth/resource";
353355

354356
const backend = defineBackend({

0 commit comments

Comments
 (0)