-
Notifications
You must be signed in to change notification settings - Fork 5
Feat/data retention backup #907
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
Draft
jusdino
wants to merge
13
commits into
csg-org:development
Choose a base branch
from
InspiringApps:feat/data-retention-backup
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+5,052
−135
Draft
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
abf66cd
Introduce backup account vaults
jusdino e76737d
Cache and re-use synthesized apps in tests
jusdino c323831
Fix backup config handling
jusdino 3007460
WIP: Table backup plans
jusdino 1a224de
WIP: move backup stack into nested stack
jusdino b676f7e
WIP: backup plans for Dynamo
jusdino 40e03c6
Backups for s3
jusdino c59119e
Cognito user backups
jusdino 4a9da38
Merge branch 'development' into feat/data-retention-backup
jusdino ba1ca23
Update backup README to now reference specific secondary accounts
landonshumway-ia cef4507
Add reference to secondary accounts in multi-account README
landonshumway-ia 032a333
fix backup vault role to reference correct vault arn
landonshumway-ia dc8a5c6
update backup cdk context example to include env name
landonshumway-ia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,43 @@ | |
"security_profile": "VULNERABLE", | ||
"recaptcha_public_key": "123-KFEUsjehfuejILDVUKkRnAF9SSzb8o9uv5lY7Ih", | ||
"robots_meta": "noindex,nofollow", | ||
"notifications": { | ||
"notifications": { | ||
"ses_operations_support_email": "[email protected]", | ||
"email": [ | ||
"[email protected]" | ||
] | ||
}, | ||
"backup_policies": { | ||
"general_data": { | ||
"schedule": { | ||
"week_day": "5", | ||
"year": "*", | ||
"month": "*", | ||
"hour": "5", | ||
"minute": "0" | ||
}, | ||
"delete_after_days": 180, | ||
"cold_storage_after_days": 30 | ||
}, | ||
"frequent_updates": { | ||
"schedule": { | ||
"week_day": "5", | ||
"year": "*", | ||
"month": "*", | ||
"hour": "5", | ||
"minute": "0" | ||
}, | ||
"delete_after_days": 180, | ||
"cold_storage_after_days": 30 | ||
} | ||
} | ||
} | ||
}, | ||
"backup_config": { | ||
"backup_account_id": "111122223333", | ||
"backup_region": "us-west-2", | ||
"general_vault_name": "CompactConnectBackupVault", | ||
"ssn_vault_name": "CompactConnectBackupVault-SSN" | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
from aws_cdk import Duration | ||
from aws_cdk.aws_backup import ( | ||
BackupPlan, | ||
BackupPlanCopyActionProps, | ||
BackupPlanRule, | ||
BackupResource, | ||
BackupSelection, | ||
BackupVault, | ||
IBackupVault, | ||
) | ||
from aws_cdk.aws_events import Schedule | ||
from aws_cdk.aws_iam import IRole | ||
from constructs import Construct | ||
|
||
|
||
class CCBackupPlan(Construct): | ||
""" | ||
Common construct for creating backup plans for CompactConnect resources with cross-account replication. | ||
This consolidated backup plan construct can be used for any AWS resource type that supports | ||
AWS Backup (DynamoDB tables, S3 buckets, etc.) by accepting a list of backup resources | ||
and a name prefix. | ||
""" | ||
|
||
def __init__( | ||
self, | ||
scope: Construct, | ||
construct_id: str, | ||
*, | ||
backup_plan_name_prefix: str, | ||
backup_resources: list[BackupResource], | ||
backup_vault: BackupVault, | ||
backup_service_role: IRole, | ||
cross_account_backup_vault: IBackupVault, | ||
backup_policy: dict, | ||
**kwargs, | ||
): | ||
super().__init__(scope, construct_id, **kwargs) | ||
|
||
# Create backup plan | ||
self.backup_plan = BackupPlan( | ||
self, | ||
'BackupPlan', | ||
backup_plan_name=f'{backup_plan_name_prefix}-BackupPlan', | ||
backup_plan_rules=[ | ||
BackupPlanRule( | ||
rule_name=f'{backup_plan_name_prefix}-Backup', | ||
backup_vault=backup_vault, | ||
schedule_expression=Schedule.cron(**backup_policy['schedule']), | ||
delete_after=Duration.days(backup_policy['delete_after_days']), | ||
move_to_cold_storage_after=Duration.days(backup_policy['cold_storage_after_days']), | ||
copy_actions=[ | ||
BackupPlanCopyActionProps( | ||
destination_backup_vault=cross_account_backup_vault, | ||
delete_after=Duration.days(backup_policy['delete_after_days']), | ||
move_to_cold_storage_after=Duration.days(backup_policy['cold_storage_after_days']), | ||
) | ||
], | ||
) | ||
], | ||
) | ||
|
||
# Create backup selection to include the resources | ||
self.backup_selection = BackupSelection( | ||
self, | ||
'BackupSelection', | ||
backup_plan=self.backup_plan, | ||
resources=backup_resources, | ||
backup_selection_name=f'{backup_plan_name_prefix}-Selection', | ||
role=backup_service_role, | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not be backing up our beta environment data. As it is intended to be ephemeral in nature, since it will likely have real SSNs mixed in with test data, which we don't want to backup for non-prod purposes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@landonshumway-ia This applies to cross-account backups as well as same-account backups for beta, correct?