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!
Top comments (0)