01 Define the necessary Amazon Backup plan, including the backup rules required for scheduled (daily) RDS database backups. Create a new JSON document, name it daily-35day-retention.json, and paste the content listed below. The following example represents a predefined Amazon Backup plan that takes daily backups (in this case AWS RDS instance snapshots) and has a retention period of 35 days:
{
"BackupPlanName": "cc-project5-backup-plan",
"Rules": [
{
"RuleName": "DailyBackups",
"TargetBackupVaultName": "Default",
"ScheduleExpression": "cron(0 5 ? * * *)",
"StartWindowMinutes": 480,
"CompletionWindowMinutes": 10080,
"Lifecycle": {
"DeleteAfterDays": 35
}
}
]
}
02 Run create-backup-plan command (OSX/Linux/UNIX) using the backup plan definition created at the previous step (i.e. daily-35day-retention.json) as value for the --backup-plan command parameter, to create your new Amazon Backup plan:
aws backup create-backup-plan
--region us-east-1
--backup-plan file://daily-35day-retention.json
03 The command output should return the command request metadata:
{
"BackupPlanArn": "arn:aws:backup:us-east-1:123456789012:backup-plan:abcd1234-abcd-1234-abcd-1234abcd1234",
"VersionId": "ABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCD",
"CreationDate": 1552652281.971,
"BackupPlanId": "abcd1234-abcd-1234-abcd-1234abcd1234"
}
04 Run create-backup-selection command (OSX/Linux/UNIX) using the ID of the newly created backup plan as parameter, to assign the specified Amazon Backup plan to an RDS database instance, identified by the ARN "arn:aws:rds:us-east-1:123456789012:db:cc-project5-instance", using the default IAM service role provided by AWS Backup, identified by "arn:aws:iam::123456789012:role/service-role/AWSBackupDefaultServiceRole". After the create-backup-selection command request is executed, Amazon Backup will use the backup plan created at the previous steps to take daily snapshots of your RDS database instance and manage these snapshots using the predefined backup rules associated with your AWS Backup plan:
aws backup create-backup-selection
--region us-east-1
--backup-plan-id abcd1234-abcd-1234-abcd-1234abcd1234
--backup-selection SelectionName=cc-project5-db-instance,IamRoleArn=arn:aws:iam::123456789012:role/service-role/AWSBackupDefaultServiceRole,Resources=arn:aws:rds:us-east-1:123456789012:db:cc-project5-instance
05 The command output should return the command request metadata:
{
"SelectionId": "12341234-abcd-abcd-abcd-123412341234",
"CreationDate": 1552652418.029,
"BackupPlanId": "abcd1234-abcd-1234-abcd-1234abcd1234"
}
06 If required, repeat step no. 1 – 5 to create and configure new Amazon Backup plans for other AWS RDS database instances provisioned in the selected region.
07 Change the AWS region by updating the --region command parameter value and repeat steps no. 1 – 6 to perform the remediation/resolution process for other regions.