Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storage): update instructions for adding external S3 buckets to Amplify #8289

Merged
merged 7 commits into from
Apr 8, 2025

Conversation

tiffanynwyeung
Copy link
Member

@tiffanynwyeung tiffanynwyeung commented Mar 18, 2025

Description of changes:

  • Fix permissions policy when adding IAM roles/permissions to an external S3 bucket to correctly mention both <bucket-name>/ as well as <bucket-name>/*
  • Update backend.addOutput to specify more options like paths and user group configuration, as well as required Amplify policies in order to access external S3 bucket
  • Add different examples for configuring custom authorization rules/user access types
  • Update manual Amplify.configure example to match new backend.addOutput example
  • Update amplify_outputs.json example to match new backend.addOutput example

Related GitHub issue #, if available:

#8202 and aws-amplify/amplify-ui#6258

Instructions

If this PR should not be merged upon approval for any reason, please submit as a DRAFT

Which product(s) are affected by this PR (if applicable)?

  • amplify-cli
  • amplify-ui
  • amplify-studio
  • amplify-hosting
  • amplify-libraries

Which platform(s) are affected by this PR (if applicable)?

  • JS
  • Swift
  • Android
  • Flutter
  • React Native

Please add the product(s)/platform(s) affected to the PR title

Checks

  • Does this PR conform to the styleguide?

  • Does this PR include filetypes other than markdown or images? Please add or update unit tests accordingly.

  • Are any files being deleted with this PR? If so, have the needed redirects been created?

  • Are all links in MDX files using the MDX link syntax rather than HTML link syntax?

    ref: MDX: [link](https://docs.amplify.aws/)
    HTML: <a href="https://docs.amplify.aws/">link</a>

When this PR is ready to merge, please check the box below

  • Ready to merge

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tiffanynwyeung tiffanynwyeung force-pushed the expand-external-s3-integration-docs branch 3 times, most recently from 07579cc to 8882f9f Compare March 31, 2025 20:48
@tiffanynwyeung tiffanynwyeung marked this pull request as ready for review March 31, 2025 20:50
Below are several examples of configuring the backend to define a custom S3 bucket:

<BlockSwitcher>
<Block name="Guest Users">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reordered "Guest Users" and "Authenticated Users" examples to match the order listed in the custom auth rules/access types page on the docs

// Import existing bucket
const customBucket = Bucket.fromBucketAttributes(bucketStack, "MyCustomBucket", {
bucketArn: "arn:aws:s3:::<bucket-name>",
region: "<region>"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@josefaidt Using Bucket.fromBucketAttributes here instead of Bucket.fromBucketName as it allows for explicit region specification. This is important in the scenario where a bucket being imported exists in a different region from the backend stack; without specifying the region, the outputs will default to the backend stack region and throw an access error.

Copy link
Contributor

@ashika112 ashika112 Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wanted to call out, Amplify Storage Browser in specific will need the buckets to be in same region because of some restriction in IAM IDC and AccessGrants setup. This is only for managed auth use cases though. That said Amplify Storage APIs itself doesnt bother much about region so i guess choosing one over another.

@josefaidt is there any backend best practices that you are aware of for choosing one over an another?

@tiffanynwyeung tiffanynwyeung force-pushed the expand-external-s3-integration-docs branch from 0c9909b to f0cbbba Compare April 5, 2025 00:58
@tiffanynwyeung tiffanynwyeung force-pushed the expand-external-s3-integration-docs branch from f0cbbba to 730e80d Compare April 5, 2025 00:59
ashika112
ashika112 previously approved these changes Apr 7, 2025
@ashika112
Copy link
Contributor

Good work on this tiffany

@tiffanynwyeung tiffanynwyeung merged commit b0512e0 into main Apr 8, 2025
12 checks passed
@tiffanynwyeung tiffanynwyeung deleted the expand-external-s3-integration-docs branch April 8, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants