ec2removeimg(1) | General Commands Manual | ec2removeimg(1) |
NAME¶
ec2removeimg - Remove images in EC2
SYNOPSIS¶
ec2removeimg [option]
DESCRIPTION¶
ec2removeimg Remove an image in EC2 by deregistering the AMI and deleting the associated snapshot.
OPTIONS¶
- -a --account ACCOUNT_NAME
- Specifies the account to use to connect to EC2. The account is specified in the config file ~/.ec2utils.conf. The account is specified as a section with [account-ACCOUNT_NAME] delimiter. The options of the sections are: access_key_id secret_access_key ssh_key_name and ssh_private_key. This allows the program to connect to EC2. If the access_key_id and/or secret_access_key are not found in ~/.ec2utils.conf, the search will use the ACCOUNT_NAME to look for a matching section [profile ACCOUNT_NAME] in ~/.aws/config or [ACCOUNT_NAME] in ~/.aws/credentials. Only the access_key_id and secret_access_key options are used by this tool.
- --access-id AWS_ACCESS_KEY
- Specifies the AWS access key and overrides the value given for the account with the access_key_id in the configuration file.
- --all
- Deletes all images that match the criteria for image lookup. By default the tool will only delete an image if there is a singular match.
- -n --dry-run
- The program will not perform any action. It will provide information on stdout about the actions it would perform.
- -f --file CONFIG_FILE
- Specifies the configuration file to use. The default is ~/.ec2utils.conf.
- --image-id AMI_ID
- Specify the AMI ID of the image to be removed. This option is mutually exclusive with the --image-name, --image-name-frag, and --image-name-match.
- --image-name IMAGE_NAME
- Specify the name of the image to be removed. The program will look for an exact match of the name. This option is mutually exclusive with --image-id, --image-name-frag, and --image-name-match.
- --image-name-frag IMAGE_NAME_FRAGMENT
- Specify a section of an image name for the image(s) to be removed. Every image that matches the name fragment will be removed. This option is mutually exclusive with --image-id, --image-name, and --image-name-match.
- --image-name-match REGEX
- Specify a regular expression to match an image name. Every image matching the regular expression will be removed. This option is mutually exclusive with --image-id, --image-name, and --image-name-frag.
- --no-confirm
- Delete the image without waiting for confirmation input. This will only delete the image without confirmation if there is a unique match of the image selection criteria given or if the --all option is specified, all matches will be deleted.
- --preserve-snap
- This options will preserve the snapshot associated with the AMI.
- -r --regions EC2_REGIONS
- A comma separated list of Amazon EC2 regions, or a single region. If no region argument is specified all EC2 connected regions will be processed. EC2 disconnected regions have different API keys and thus the specified account would not work with the disconnected regions. If a disconnected region is to be processed specify the region explicitly on the command line, and only the region of interest along with the matching account.
- -s --secret-key AWS_SECRET_KEY
- Specifies the AWS secret access key and overrides the value given for the account with the secret_access_key in the configuration file.
- --verbose
- Print extra output about the operations performed to STDOUT.
- --version
- Print the version of he program
EXAMPLE¶
ec2removeimg --account example --image-name-match v15 --all --no-confirm --verbose
Will delete all images in all connected regions that match the v15 regular expression in the image name. All associated snapshots will be deleted as well, no confirmation of the delete operation is required by the user and progress will be written to STDOUT.
AUTHOR¶
SUSE Public Cloud Team (public-cloud-dev@susecloud.net)