#Migrating Next.js + AWS SDK Project to Amplify Gen 2 with CDK

2 messages · Page 1 of 1 (latest)

halcyon shale
#

Hello!
New here.

I'm working on modernizing an existing Next.js project that heavily utilizes AWS services via the AWS SDK using JS, but I was having a lot of issues trying to get any kind of authentication without hardcoding. This lead me to decide to start the switch to Gen 2 with Vite + React + TS instead. I need guidance on the best approach to convert it to Amplify Gen 2 using AWS CDK. I'm honestly pretty lost with all the options and whats recommended to use.

Here's my current setup:

  • Next.js application with numerous API routes for backend functionality
  • Extensive use of DynamoDB with AWS SDK v3 for complex data operations
  • Amazon SES for email operations
  • S3 for data storage and retrieval (including fetching location data)
  • Custom authentication system (not using Cognito)
  • Complex frontend React components with state management
  • Integration with a third-party API for price data

Functionalities:

  • Managing price changes across multiple locations
  • Generating and managing links for price change operations
  • Creating reports and sending emails
  • Locking/unlocking price change capabilities

Some specific questions I have, any answered would be a great help, no need to answer them all:

  1. What's the recommended approach for restructuring my Next.js app and API routes in the Amplify Gen 2 format? How can I maintain the current functionality while taking advantage of Amplify CDK and Gen 2?

  2. Can I migrate my complex DynamoDB operations to Amplify's new Gen 2 data manager? My current setup includes intricate queries, updates, and data processing directly with DynamoDB - how would this translate to Amplify's data handling?

  3. What's the best way to handle my current S3 and SES integrations in Amplify Gen 2? Are there Amplify-specific constructs I should be using for these services instead?

  4. My site currently generates unique links for locations that can be passed to someone to change prices. The dashboard however should not be accessible to anyone but the admin. Is there a way to do this better in modern setups? With the Quickstart react documentation I saw users can see different things depending on who is accessing it. Could you manually create users so they can have access to a specific price sheet?

  5. My project involves complex state management and data manipulation on the frontend. Are there any Amplify features or best practices that could help simplify this?

  6. How can I use AWS CDK effectively to define my current AWS resources (DynamoDB tables, S3 buckets, etc.) in the Amplify Gen 2 setup?

  7. I'm currently using a third-party API for some data. How can I integrate this external API call within the Amplify Gen 2 architecture?

  8. Are there any specific strategies for handling my current use of Next.js API routes in an Amplify Gen 2 context?

Any insights, resources, or what to avoid would be greatly appreciated!

open fiber
#

Hey, with number of question i think a call may be better to clarify these on a deeper level. but on a high level
Amplify Gen 2 is a typescript based experience that is built on AWS CDK making it simpler to setup your backend and working with AppSync API.
we provide support for Auth, Storage, API, Lambda function etc. If you require additional AWS services you can use AWS CDK library to add them.

or you are looking to use AWS CDK you can use Amplify published constructs as part of your backend. we do provide our data api and auth constructs: https://docs.amplify.aws/react/reference/cdk-constructs/