ec2deprecateimg(1) | General Commands Manual | ec2deprecateimg(1) |
NAME¶
ec2deprecateimg - Deprecate images in EC2 by adding tags
SYNOPSIS¶
ec2deprecateimg [option]
DESCRIPTION¶
ec2deprecateimg Deprecate images in EC2 by adding tags to an image. The EC2 platform does not support a formal deprecation mechanism. The mechanism implemented by this tool is a convention. Unfortunately the tags are not sticky, i.e. not visible to others if the image is shared.
Images are tagged with: - Deprecated on -> today's date in YYYYMMDD format - Removal date -> today's date plus the deprecation period specified - Replacement image -> The AMI ID and name of the replacement image
The image set as the replacement is removed from the list of potential images to be deprecated before any matching takes place. Therefore, the deprecation search criteria specified with --image-name-frag or --image-name-match cannot match the replacement image.
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.
- --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.
- -d --deprecation-period NUMBER_OF_MONTHS
- Specifies the number of months this image will be considered deprecated. After the deprecation period expires the image may be removed. The deprecation time is added to the date on which the program is executed and forms the value for the Removal date tag in the format YYYYMMDD. The default deprecation period is 6 months.
- --force
- Specify that any images that have already been tagged as deprecated should be tagged again with the new deprecation information. This overwrites the previous information and the old data is lost.
- -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 marked as deprecated. 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 deprecated. 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 deprecated. Every image that matches the name fragment will be marked as deprecated. This option is mutually exclusive with --image-id, --image-name-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 deprecated. This option is mutually exclusive with --image-id, --image-name-name, and --image-name-frag.
- --image-virt-type hvm|para
- Specify the virtualization type of the image to be deprecated. This option works in addition to --image-id, --image-name, --image-name-frag, --image-name-match. Every specified condition must be satisfied in order to deprecate the image.
- --public-only
- Consider only images that are public as a replacement or for deprecation purposes.
- --replacement-id AMI_ID
- Specify the AMI ID of the image considered to be the replacement for the image(s) that are being deprecated. The option is mutually exclusive with --replacement-name, --replacement-name-frag, and --replacement-name-match. The AMI ID and the dynamically determined image name are used in combination to form the value for the Replacement image tag in the form AMI_ID -- IMAGE_NAME. One of --replacement-id, --replacement-name, --replacement-name-frag, or --replacement-name-match, must be specified.
- --replacement-name IMAGE_NAME
- Specify the name of the image considered to be the replacement for the image(s) that are being deprecated. The option is mutually exclusive with the --replacement-id option. The image name and the dynamically determined AMI ID are used in combination to form the value for the Replacement image tag in the form AMI_ID -- IMAGE_NAME. One of --replacement-id, --replacement-name, --replacement-name-frag, or --replacement-name-match, must be specified.
- --replacement-name-frag IMAGE_NAME_FRAGMENT
- Specify a section of an image name to be considered for the replacement image. This option is mutually exclusive with --replacement-id, --replacement-name, and --replacement-name-match. The dynamically determined AMI ID and the dynamically determined image name are used in combination to form the value for the Replacement image tag in the form AMI_ID -- IMAGE_NAME. One of --replacement-id, --replacement-name, --replacement-name-frag, or --replacement-name-match, must be specified.
- --replacement-name-match REGEX
- Specify a regular expression to match an image name to be considered for
the replacement image. This option is mutually exclusive with
--replacement-id, --replacement-name, and
--replacement-name-frag.
The dynamically determined AMI ID and the dynamically determined image name are used in combination to form the value for the Replacement image tag in the form AMI_ID -- IMAGE_NAME. One of --replacement-id, --replacement-name, --replacement-name-frag, or --replacement-name-match, must be specified. - -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¶
ec2deprecateimg --account example --image-name-match v15 --image-virt-type hvm --replacement-name exampleimage_v16
Will mark all images in all connected regions that have the HVM virtualization type and match the v15 regular expression as deprecated. The replacement image will be set to the AMI ID found in the region being processed that matches the exampleimage_v16 name exactly.
AUTHOR¶
Robert Schweikert (rjschwei@suse.com)