Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dynamodb construct with default deletion protection and mandatory opt-in/opt-out setting for DevX-backup #2288

Merged
merged 5 commits into from
May 1, 2024

Conversation

michaelwmcnamara
Copy link
Contributor

@michaelwmcnamara michaelwmcnamara commented Apr 29, 2024

What does this change?

This PR adds a construct for dynamoDB tables
This construct will enable deletion protection by default.
It also adds a mandatory opt-in/opt-out field for aws backups.
This last forces a decision on whether or not to use the AWS backup vault to protect backup data from accidental or malicious deletion.
This decision should almost always be yes, however there are circumstances in which a team might need to use a different form of storage for their backup. The important thing is that the decision is made explicitly.
If users opt-out, they will need to provide a reason for their decision. This is to allow this information to be captured in security audits.

This is a new construct, so will not be a breaking change.

How to test

Unit tests added to cover main scenarios.

How can we measure success?

New stacks created in CDK have deletion protection enabled and a clear decision on whether to opt-in or out of AWS Backups.
It is harder to delete DynamoDB tables by accident.
We do not have a build up of tables whose backup status is unknown and un-tracked.
Our data infrastructure is more secure and more resilient

Have we considered potential risks?

Currently this construct is not in use.
Only risks are:

  • The construct is not adopted and teams continue to use the native AWS dynamoDB construct
  • As an organisation we suddenly want to switch to a multi-region architecture. This dynamoDB construct uses the original Table construct which does not have as good support for multi-region features - as opposed to the new TableV2 construct.
    This risk is minimal for now as a github search revealed we are using the original Table construct across all our current repositories and the TableV2 is not in use on any of our repos.
    This PR has been optimised to maximise adoption by existing teams.

That said a new DynamoDB construct that uses the TableV2 classes would be a useful addition should any teams ever need to adopt a multi-regioin AWS infrastructure.

Checklist

  • I have listed any breaking changes, along with a migration path 1
  • No breaking changes as this is a new construct
  • I have updated the documentation as required for the described changes 2

Footnotes

  1. Consider whether this is something that will mean changes to projects that have already been migrated, or to the CDK CLI tool. If changes are required, consider adding a checklist here and/or linking to related PRs.

  2. If you are adding a new construct or pattern, has new documentation been added? If you are amending defaults or changing behaviour, are the existing docs still valid?

Copy link

changeset-bot bot commented Apr 29, 2024

🦋 Changeset detected

Latest commit: 3f9fe30

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@guardian/cdk Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@michaelwmcnamara michaelwmcnamara force-pushed the mm-add-dynamodb-construct branch 5 times, most recently from b77d309 to 3b35a13 Compare April 30, 2024 11:51
@michaelwmcnamara michaelwmcnamara changed the title mm adding dynamodb construct Add Dynamodb construct with default deletion protection and mandatory opt-in/opt-out setting for DevX-backup Apr 30, 2024
@michaelwmcnamara michaelwmcnamara force-pushed the mm-add-dynamodb-construct branch 2 times, most recently from f26bc25 to c3e45ea Compare April 30, 2024 13:49
@michaelwmcnamara michaelwmcnamara marked this pull request as ready for review April 30, 2024 13:56
@michaelwmcnamara michaelwmcnamara requested a review from a team as a code owner April 30, 2024 13:56
Copy link
Contributor

@jacobwinch jacobwinch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to reformat to get the CI build to pass (you can do this with npm run format ). I've also left one comment on the release type (I think this should be a minor release).

Once those small issues have been addressed I think this is good to go 👍

@michaelwmcnamara
Copy link
Contributor Author

I think you need to reformat to get the CI build to pass (you can do this with npm run format ). I've also left one comment on the release type (I think this should be a minor release).

Once those small issues have been addressed I think this is good to go 👍

Thanks for your help with this @jacobwinch!

@michaelwmcnamara michaelwmcnamara merged commit a6291a4 into main May 1, 2024
2 checks passed
@michaelwmcnamara michaelwmcnamara deleted the mm-add-dynamodb-construct branch May 1, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants