Skip to content

Script: delete_image

Bruno Galindro da Costa edited this page May 10, 2015 · 1 revision

delete_image

Use this script to delete EC2 images and associated snapshots in batch mode

How to use

usage: delete_image [-h]
                    [-r {us-east-1,cn-north-1,ap-northeast-1,eu-west-1,ap-southeast-1,ap-southeast-2,us-west-2,us-gov-west-1,us-west-1,eu-central-1,sa-east-1}]
                    [-c CONFIG] -i IMAGE_IDS [IMAGE_IDS ...] [-d] [-y]

Delete ec2 image

optional arguments:
  -h, --help            show this help message and exit
  -r {us-east-1,cn-north-1,ap-northeast-1,eu-west-1,ap-southeast-1,ap-southeast-2,us-west-2,us-gov-west-1,us-west-1,eu-central-1,sa-east-1}, --region {us-east-1,cn-north-1,ap-northeast-1,eu-west-1,ap-southeast-1,ap-southeast-2,us-west-2,us-gov-west-1,us-west-1,eu-central-1,sa-east-1}
                        AWS Region
  -c CONFIG, --config CONFIG
                        Config file
  -i IMAGE_IDS [IMAGE_IDS ...], --image_ids IMAGE_IDS [IMAGE_IDS ...]
                        Image ID(s)
  -d, --deletesnapshots
                        Delete snapshots associated to the image(s)
  -y, --yes             Delete image(s) without prompt
  • -c/--config: The config file is used only to control logging behaviour
  • -r/--region: The region to search for launch configurations. Default region is set on galintools.json
  • -i/--image_ids: List of images to delete. This argument is required
  • -d/--deletesnapshots: You could choose to delete the snapshots of the ec2 image. Just use this parameter for that.
  • -y/--yes: Delete launch configuration(s) without prompt

Examples

  • Delete EC2 images
$ delete_image -i ami-xxxxxx ami-yyyyy
  • Delete EC2 images and delete associated snapshots
$ delete_lc -i ami-xxxxxx ami-yyyyy -d