<p>Coincidentally I had to do something very similar yesterday. This is the script I used:</p>
<pre class="lang-sh prettyprint-override"><code>#!/bin/bash -e

VAULT_NAME=...   # put your Backup Vault name here

for ARN in $(aws backup list-recovery-points-by-backup-vault --backup-vault-name &quot;${​​​​​​​VAULT_NAME}​​​​​​​&quot; --query 'RecoveryPoints[].RecoveryPointArn' --output text); do
  echo &quot;deleting ${​​​​​​​ARN}​​​​​​​ ...&quot;
  aws backup delete-recovery-point --backup-vault-name &quot;${​​​​​​​VAULT_NAME}​​​​​​​&quot; --recovery-point-arn &quot;${​​​​​​​ARN}​​​​​​​&quot;
done
</code></pre>
<p>You can also add <code>--by-created-before</code> to delete the old backups only.</p>
<p>Hope that helps :)</p>

CC BY-SA 4.0
2020-11-24T21:57:01.490Z
2020-11-24T21:57:01.490Z
MLu
<p>I'm using AWS Backup to create snapshots of my production server. My current backup plan has infinite retention and that ran me into gigabytes of storage.</p>
<p>What would be the best way to fix that? I saw I can't remove the backups in bulk (can only select and remove each single backup, but I have 100s).</p>
<p>Is it possible to modify the backup rule so that it removes the previous backups? Or is there a way to select and remove all the backups done by AWS Backup?</p>

<amazon-web-services><backup>
How to remove the AWS Backups
Aerodynamika
# How to remove the AWS Backups

(Asked by: username_0 on 2020-11-24)

I'm using AWS Backup to create snapshots of my production server. My current backup plan has infinite retention and that ran me into gigabytes of storage.

What would be the best way to fix that? I saw I can't remove the backups in bulk (can only select and remove each single backup, but I have 100s).

Is it possible to modify the backup rule so that it removes the previous backups? Or is there a way to select and remove all the backups done by AWS Backup?

**Tags:** amazon-web-services, backup


---

## 1 answers

### Answer by username_1 on 2020-11-24. Score: 2

Coincidentally I had to do something very similar yesterday. This is the script I used:
#!/bin/bash -e

VAULT_NAME=...   # put your Backup Vault name here

for ARN in $(aws backup list-recovery-points-by-backup-vault --backup-vault-name "${​​​​​​​VAULT_NAME}​​​​​​​" --query 'RecoveryPoints[].RecoveryPointArn' --output text); do
  echo "deleting ${​​​​​​​ARN}​​​​​​​ ..."
  aws backup delete-recovery-point --backup-vault-name "${​​​​​​​VAULT_NAME}​​​​​​​" --recovery-point-arn "${​​​​​​​ARN}​​​​​​​"
done

You can also add --by-created-before to delete the old backups only.
Hope that helps :)


---

