You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace `<AWS-account-ID>` with your AWS account ID and `<role-name>` with the IAM role associated with your Amplify Auth setup. Replace `<bucket-name>` with the S3 bucket name.
71
72
72
73
You can refer to [Amazon S3's Policies and Permissions documentation](https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-policy-language-overview.html) for more ways to customize access to the bucket.
73
74
75
+
<Calloutwarning>
76
+
In order to make calls to your S3 bucket from your application, you must also set up a CORS Policy for your S3 bucket. This applies only to manually-configured S3 buckets. Learn more about [setting up a CORS Policy for your S3 bucket](/[platform]/build-a-backend/storage/extend-s3-resources/#for-manually-configured-s3-resources).
77
+
</Callout>
78
+
74
79
### Specify S3 bucket in Amplify's backend config
75
80
76
-
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.
81
+
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.
77
82
78
83
<Callout>
79
84
@@ -85,7 +90,10 @@ If you specify a custom S3 bucket, no sandbox storage resource will be created.
85
90
86
91
</Callout>
87
92
88
-
```javascript
93
+
Below is an example of configuring the backend to define a custom S3 bucket:
@@ -137,7 +225,6 @@ In addition to manually configuring your storage options, you will also need to
137
225
### Using Amplify configure
138
226
Existing storage resource setup can be accomplished by passing the resource metadata to `Amplify.configure`. This will configure the Amplify Storage client library to interact with the additional resources. It's recommended to add the Amplify configuration step as early as possible in the application lifecycle, ideally at the root entry point.
139
227
140
-
141
228
```ts
142
229
import { Amplify } from'aws-amplify';
143
230
@@ -169,6 +256,7 @@ Amplify.configure({
169
256
170
257
Alternatively, existing storage resources can be used by creating or modifying the `amplify_outputs.json` file directly.
171
258
259
+
{/* cSpell:disable */}
172
260
```ts title="amplify_outputs.json"
173
261
{
174
262
"auth": {
@@ -182,7 +270,37 @@ Alternatively, existing storage resources can be used by creating or modifying t
182
270
{
183
271
"name": "<your-default-bucket-friendly-name>",
184
272
"bucket_name": "<your-default-bucket-name>",
185
-
"aws_region": "<your-default-bucket-region>"
273
+
"aws_region": "<your-default-bucket-region>",
274
+
// optional: `paths` can be used to set up access to specific bucket prefixes,
275
+
// and configure access to those prefixes for different user types
276
+
"paths": {
277
+
"public/*": {
278
+
"guest": [
279
+
"get",
280
+
"list"
281
+
],
282
+
"authenticated": [
283
+
"get",
284
+
"list",
285
+
"write",
286
+
"delete"
287
+
]
288
+
},
289
+
"admin/*": {
290
+
"authenticated": [
291
+
"get",
292
+
"list",
293
+
"write",
294
+
"delete"
295
+
],
296
+
"groupsadmin": [
297
+
"get",
298
+
"list",
299
+
"write",
300
+
"delete"
301
+
]
302
+
}
303
+
}
186
304
},
187
305
{
188
306
"name": "<your-additional-bucket-friendly-name>",
@@ -193,4 +311,5 @@ Alternatively, existing storage resources can be used by creating or modifying t
0 commit comments