Skip to content

Commit

Permalink
remove outputs override
Browse files Browse the repository at this point in the history
  • Loading branch information
jjarvisp committed Aug 6, 2024
1 parent ffc18f7 commit 15207b5
Showing 1 changed file with 8 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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: "<your-primary-bucket-name>",
region: "<your-primary-bucket-region>",
// your default bucket metadata should be duplicated below
// your default bucket metadata should be duplicated below
buckets: {
"<your-primary-bucket-friendly-name>": {
bucketName: "<your-primary-bucket-name>",
region: "<your-primary-bucket-region>",
},
"<your-additional-bucket-friendly-name>": {
bucketName: "<your-additional-bucket-name>",
region: "<your-additional-bucket-region>",
},
},
"<your-additional-bucket-friendly-name>": {
bucketName: "<your-additional-bucket-name>",
region: "<your-additional-bucket-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.
Expand Down

0 comments on commit 15207b5

Please sign in to comment.