Reputation: 133
I have developed an API using flask + postgreSQL and the users registration process was ministered by such infrastructure. I then decided to change the infrastructure in general. I decided to use NestJS + dynamoDB + cognito. In other words, I decided to go serverless! However, I am finding quite hard to understand how to organize my project into development, staging and production environments.
To sum up, I have two questions
I will give an example for each question in order to clarify what my doubts are.
Example for (1)
In the first architecture using flask + postgreSQL I created a script that would wipe out the entire local database and create a mock data with the goal of executing functions so the API could be tested. But since I have no local environment, should I replicate the entire production environment in AWS in order to test it?
Example for (2)
Usually when I was testing new features in the API I would erase and create new mock data, and my coworkers would do the same in their local machines. In other words, each developer had their local system ready to be "screwed" haha without disturbing other developers' work. How could I do something similar in dynamoDB / serveless architecture?
Upvotes: 1
Views: 477
Reputation: 13791
If your tests involve relatively low amount of data being written and read to the table, you can do them using the real AWS, but just use a different table (and probably different account!) from your production table. The test table can be created and deleted in a matter of seconds.
However, if the tests involve a more substantial amount of data, testing this way can become expensive and slow - in which case you might prefer to have a local version of DynamoDB running on your own machine and connect to that in your tests. As far as I know, you have to options for a locally-installed DynamoDB:
Upvotes: 1