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

[Feature Request]Add an option of ProjectionType for Dynamodb Global Secondary Index (Amplify Gen2) #2945

Open
MyNameIsTakenOMG opened this issue Oct 11, 2024 · 2 comments
Labels

Comments

@MyNameIsTakenOMG
Copy link

MyNameIsTakenOMG commented Oct 11, 2024

Environment information

System:
  OS: macOS 14.6.1
  CPU: (8) arm64 Apple M1 Pro
  Memory: 122.77 MB / 16.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 18.20.4 - /usr/local/bin/node
  Yarn: 1.22.19 - /opt/homebrew/bin/yarn
  npm: 10.7.0 - /usr/local/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/auth-construct: 1.3.0
  @aws-amplify/backend: 1.1.1
  @aws-amplify/backend-auth: 1.1.3
  @aws-amplify/backend-cli: 1.2.5
  @aws-amplify/backend-data: 1.1.2
  @aws-amplify/backend-deployer: 1.1.0
  @aws-amplify/backend-function: 1.3.4
  @aws-amplify/backend-output-schemas: 1.2.0
  @aws-amplify/backend-output-storage: 1.1.1
  @aws-amplify/backend-secret: 1.1.0
  @aws-amplify/backend-storage: 1.1.2
  @aws-amplify/cli-core: 1.1.2
  @aws-amplify/client-config: 1.2.1
  @aws-amplify/deployed-backend-client: 1.4.0
  @aws-amplify/form-generator: 1.0.1
  @aws-amplify/model-generator: 1.0.5
  @aws-amplify/platform-core: 1.0.6
  @aws-amplify/plugin-types: 1.2.1
  @aws-amplify/sandbox: 1.2.0
  @aws-amplify/schema-generator: 1.2.1
  aws-amplify: 6.5.2
  aws-cdk: 2.154.1
  aws-cdk-lib: 2.154.1
  typescript: 5.5.3
AWS environment variables:
  AWS_STS_REGIONAL_ENDPOINTS = regional
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_SDK_LOAD_CONFIG = 1
No CDK environment variables

Describe the feature

When customizing secondary indexes with .secondaryIndexes((index) => [index("GSI-pk")]) by following the documentation, we need a way to configure the ProjectionType(KEYS_ONLY, INCLUDE , or ALL), for example, add a method .projection(<type>, [fields]?), so that we could specify which fields would be projected into our GSI tables.

By the time I am writing, the amplify backend will provision our GSIs with ProjectionType of ALL, which in my opinion is not recommended, because it might incur higher storage costs and could slow down write operations on the base table since updates will be replicated across all GSIs.

Use case

In my case, I am designing my table following one-table design, which contains multiple GSI tables. However, as I mentioned above, right now the amplify backend would provision GSIs with projectionType of ALL, which means my table data would be replicated for multiple times, which could incur a lot costs.

In addition, the projectionType cannot be modified once the GSI is provisioned, which means I either have to manually delete those GSIs and re-create them with proper ProjectionType or create those GSIs myself via aws console, cli, scripts, or custom resource

@MyNameIsTakenOMG MyNameIsTakenOMG changed the title Add an option of ProjectionType for Dynamodb Global Secondary Index (Amplify Gen2) [Feature Request]Add an option of ProjectionType for Dynamodb Global Secondary Index (Amplify Gen2) Oct 11, 2024
@ykethan
Copy link
Member

ykethan commented Oct 11, 2024

Hey,👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance 🙂

@ykethan ykethan transferred this issue from aws-amplify/amplify-backend Oct 11, 2024
@AnilMaktala AnilMaktala added the feature-request New feature or request label Oct 14, 2024
@AnilMaktala
Copy link
Member

Hey @MyNameIsTakenOMG, Thanks for requesting this. We are marking this as a feature request for the team to evaluate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants