amplify-backend icon indicating copy to clipboard operation
amplify-backend copied to clipboard

Add documentation for how to configure cloud front distribution with Amplify Storage

Open em0227 opened this issue 7 months ago • 2 comments

Environment information

System:
  OS: macOS 14.7.5
  CPU: (12) arm64 Apple M2 Pro
  Memory: 167.55 MB / 32.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 20.15.1 - ~/.nvm/versions/node/v20.15.1/bin/node
  Yarn: 1.22.22 - ~/.nvm/versions/node/v20.15.1/bin/yarn
  npm: 10.7.0 - ~/.nvm/versions/node/v20.15.1/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/auth-construct: 1.6.1
  @aws-amplify/backend: 1.14.3
  @aws-amplify/backend-ai: Not Found
  @aws-amplify/backend-auth: 1.5.1
  @aws-amplify/backend-cli: 1.5.0
  @aws-amplify/backend-data: 1.4.1
  @aws-amplify/backend-deployer: 1.1.20
  @aws-amplify/backend-function: 1.12.3
  @aws-amplify/backend-output-schemas: 1.4.1
  @aws-amplify/backend-output-storage: 1.1.5
  @aws-amplify/backend-secret: 1.2.0
  @aws-amplify/backend-storage: 1.2.6
  @aws-amplify/cli-core: 1.4.1
  @aws-amplify/client-config: 1.5.8
  @aws-amplify/data-construct: 1.16.1
  @aws-amplify/data-schema: 1.20.4
  @aws-amplify/deployed-backend-client: 1.5.2
  @aws-amplify/form-generator: 1.0.5
  @aws-amplify/model-generator: 1.0.13
  @aws-amplify/platform-core: 1.6.5
  @aws-amplify/plugin-types: 1.8.1
  @aws-amplify/sandbox: 1.2.12
  @aws-amplify/schema-generator: 1.2.8
  aws-amplify: 6.14.2
  aws-cdk: 2.1010.0
  aws-cdk-lib: 2.190.0
  typescript: 5.8.3
No AWS environment variables
No CDK environment variables

Describe the feature

S3 + CDN is a pretty common combo to use for website, especially when it comes with large amount of image.

We are hosting such a site and was hoping utilizing amplify-backend will simplify the set up process, but had difficulties when tried to set up a CDN with build-in defineStorage.

As defineStorage does not take in extra props to set up CDN, we tried to attach a CDN to the Amplify stack with cdk, however, we encountered the circular dependencies when trying to specify the origin with S3BucketOrigin.withOriginAccessControl.

Use case

Hoping to add a custom CDN distribution configuration in defineStorage or give more documentation on how to solve circular dependencies issues when configuring custom CDN with Amplify.

em0227 avatar Apr 23 '25 20:04 em0227