diff --git a/src/pages/[platform]/build-a-backend/storage/set-up-storage/index.mdx b/src/pages/[platform]/build-a-backend/storage/set-up-storage/index.mdx index b6a2be302e4..3922e649f62 100644 --- a/src/pages/[platform]/build-a-backend/storage/set-up-storage/index.mdx +++ b/src/pages/[platform]/build-a-backend/storage/set-up-storage/index.mdx @@ -37,7 +37,7 @@ Amplify Storage seamlessly integrates file storage and management capabilities i ## Building your storage backend -First, create a file `amplify/storage/resource.ts`. This file will be the location where you configure your storage backend. Instantiate storage using the `defineStorage` function and providing a `name` for your storage bucket. This `name` is a friendly name to identify your bucket in your backend configuration. Amplify will generate a unique identifier for your app using a UUID, the name attribute is just for use in your app. +First, create a file `amplify/storage/resource.ts`. This file will be the location where you configure your storage backend. Instantiate storage by using the `defineStorage` function and providing a `name` for your storage bucket. This `name` is a friendly name to identify your bucket in your backend configuration. Amplify will generate a unique identifier for your app using a UUID, the name attribute is just for use in your app. ```ts title="amplify/storage/resource.ts" import { defineStorage } from '@aws-amplify/backend'; @@ -168,57 +168,27 @@ You can accomplish this by passing your existing storage resource metadata to `A import { Amplify } from 'aws-amplify'; Amplify.configure({ + ...Amplify.getConfig(), Storage: { S3: { bucket: "", region: "", - // your default bucket metadata should be duplicated below + // your default bucket metadata should be duplicated below buckets: { "": { bucketName: "", region: "", - }, - "": { - bucketName: "", - region: "", - }, + }, + "": { + bucketName: "", + region: "", + }, }, }, }, }); ``` -Alternatively, you can use existing storage resources in your app by creating or modifying the `amplify_outputs.json` file directly. Import the file into your application and pass it the `Amplify.configure` function to configure the Amplify Storage client library. -Read more about [amplify_outputs.json](/[platform]/reference/amplify_outputs/). - -```ts title="amplify_outputs.json" -{ - // ... - "storage": { - // default bucket region - "aws_region": "us-east-2", - // default bucket name should match the AWS console - "bucket_name": "generated-default-primary-bucket-name", - // required to integrate with multiple backend storage resources - // your default bucket metadata should be duplicated below - "buckets": [ - { - // friendly name can be referenced from your application code - "name": "primaryStorage", - // bucket name should match the AWS console - "bucket_name": "generated-default-primary-bucket-name", - // bucket region - "aws_region": "us-east-2" - }, - { - "name": "secondaryStorage", - "bucket_name": "generated-secondary-bucket-name", - "aws_region": "us-east-2" - } - ] - } -} -``` ## Connect your app code to the storage backend The Amplify Storage library provides client APIs that connect to the backend resources you defined.