DEV Community

starpebble
starpebble

Posted on

1 3

Quickly populating a second AWS Amplify GraphQL environment with data

Sometimes it's more comfortable to test an AWS Amplify app with active data. 'amplify env add' creates emptiness. The GraphQL endpoint will return nothingness. Fill it up! Maybe replicate data from production, or maybe bootstrap from files in S3.

Approaches

Bootstrap from Files
Quickly upload data the second environment from data in files. To DynamoDB or RDS. Simply put data files in S3 and replicate with AWS Data Migration Service. An empty environment can be painful. Data with velocity can be painful too. Static files are really simple and can take the pain away:

  • AWS Data Migration Service (for DynamoDB or RDS resolved models)

Replicate from Production
Quickly populate a second environment with data from the production environment for comfortable testing. How exactly can somebody replicate production data to a second environment? It's easy. There are two services which can replicate the production app environment's data stores:

  • AWS Data Pipeline (for DynamoDB resolved models)
  • AWS Data Migration Service (for RDS resolved models)

Bootstrap from Files

AWS Data Migration Service can copy data from S3. DMS can copy to DynamoDB or RDS. Create a source endpoint in AWS DMS with a single S3 bucket. See Using Amazon S3 as a Source for AWS DMS. Then create a destination endpoint, for example, a single AWS DynamoDB endpoint. See Using an Amazon DynamoDB Database as a Target for AWS Database Migration Service.

Replicate from Production

Choose a service to replicate a particular type of data store. AWS Data Pipeline can perfectly copy one DynamoDB table to another. AWS Data Migration Service can perfectly copy one RDS hosted database instance to another.

Jump in the saddle with AWS Data Pipeline to replicate a DynamoDB single table. Expect a quick hop to S3. See Exporting and Importing DynamoDB data with AWS Data Pipeline.

Replicating a single RDS hosted database from one instance to another is simple. Use AWS Data Migration Service to copy the tables over. It won't take months. It will be fast.

Possibilities

When it's absolutely necessary to have data in an Amplify environment, don't let it be cumbersome. A GraphQL endpoint is more functional with data. Iterative software feature delivery goes faster. Push the data replication into the cloud! Have fun. There might be more than one way. Leave a comment with other suggestions, please!

API Trace View

Struggling with slow API calls?

Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

Top comments (0)

Heroku

This site is powered by Heroku

Heroku was created by developers, for developers. Get started today and find out why Heroku has been the platform of choice for brands like DEV for over a decade.

Sign Up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay