Skip to content

Instantly share code, notes, and snippets.

@jtroberts83
Created April 26, 2018 15:40
Show Gist options
  • Save jtroberts83/e41c50ccbcbb007628aec92e5b59e3fa to your computer and use it in GitHub Desktop.
Save jtroberts83/e41c50ccbcbb007628aec92e5b59e3fa to your computer and use it in GitHub Desktop.
- name: delete-old-snapshots-under-20-gb
resource: ebs-snapshot
description: |
Deletes a snapshot if its older than 7 days and it was created by cloud custodian
filters:
- type: value
key: VolumeSize
op: lt
value: 20
- type: age
days: 7
op: ge
- type: value
key: Description
op: regex
value: ^(Automated,Backup,-?)\w+
actions:
- delete
- name: delete-old-snapshots-under-100-over-20-gb
resource: ebs-snapshot
description: |
Deletes a snapshot if its older than 7 days and it was created by cloud custodian
filters:
- type: value
key: VolumeSize
op: ge
value: 20
- type: value
key: VolumeSize
op: lt
value: 100
- type: age
days: 7
op: ge
- type: value
key: Description
op: regex
value: ^(Automated,Backup,-?)\w+
actions:
- delete
- name: delete-old-snapshots-under-500-over-100-gb
resource: ebs-snapshot
description: |
Deletes a snapshot if its older than 7 days and it was created by cloud custodian
filters:
- type: value
key: VolumeSize
op: ge
value: 100
- type: value
key: VolumeSize
op: lt
value: 1000
- type: age
days: 7
op: ge
- type: value
key: Description
op: regex
value: ^(Automated,Backup,-?)\w+
actions:
- delete
- name: agt-delete-old-snapshots-over-1000-gb
resource: ebs-snapshot
description: |
Deletes a snapshot if its older than 7 days and it was created by cloud custodian
filters:
- type: value
key: VolumeSize
op: ge
value: 1000
- type: age
days: 7
op: ge
- type: value
key: Description
op: regex
value: ^(Automated,Backup,-?)\w+
actions:
- delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment