TL;DR
- Use rewiremock
- Create a FakeDep class with which to replace the real one
- rewiremock('../../../real/code/my-real-class').with(FakeDep);
- rewiremock.enable();
Scouring the internet for a solution for multi-region failover using a DynamoDB Global Table (v2019) in CloudFormation resulted in basically nothing. Sure, I found some solutions using an antiquated version of DynamoDB Global Tables--and this sent me down a rabbit trail until I realized that it was out-of-date.
One would think that AWS would have at least an example laying around somewhere so you aren't left trying to reinvent the wheel.
I tried posting a solution on Stack Overflow, but got bounced because it references off-site resources (GitHub) and this example is way too complicated to post in a single answer on SO. I'm starting to see why it's so hard to find good resources on common AWS questions.
After lots of trial and error, I've come up with a solution and posted it on GitHub here.
I'm new to applying licenses to code, so let me know if I did it wrong or should've chosen a different license.
The repository is a collection of common templates that will likely fill out over the years.
Here were our requirements: