ec2deprecateimg(1)
π
ec2deprecateimg β the ec2deprecateimg(1) glow-up
okay so you're in the General Commands Manual and the tool is ec2deprecateimg, and honestly? she's giving "I retire AMIs for a living and I do it fabulously." let's get into it π
β¨ NAME β¨
ec2deprecateimg β deprecate images in EC2 by adding tags
π¦ SYNOPSIS π¦
ec2deprecateimg [option]
πΈ DESCRIPTION πΈ
ec2deprecateimg deprecates images in EC2 by adding tags to an image and enabling AWS image deprecation. lowkey the tagging is kept around for backwards compatibility β the tagging mechanism is an implementation based on convention. and heads up bestie: tags are not sticky, meaning they're not visible to others if the image is shared. no cap.
so here's the tag lineup, she's got three:
- Deprecated on β the deprecation date you provided (or today's date if you provided no value) in
YYYYMMDDformat - Removal date β the deprecation date plus the deprecation period you specified
- Replacement image β the AMI ID and name of the replacement image (optional)
and in EC2 a deprecated image gets set into a state that makes it invisible to new users. which is, like, basically equivalent to a deletion. so the tool sets the deprecation data in EC2 to the removal date set for the tag. periodt.
one more iconic detail: the image set as the replacement is removed from the list of potential images to be deprecated before any matching takes place. so the deprecation search criteria you pass with --image-name-frag or --image-name-match literally cannot match the replacement image. the replacement is off the table before the auditions even start. π§
β¨ OPTIONS β¨
-a,--accountACCOUNT_NAME β specifies the account to use to connect to EC2. the account is specified in the config file~/.ec2utils.conf, as a section with the[account-ACCOUNT_NAME]delimiter. the options of the sections are:access_key_id,secret_access_key,ssh_key_nameandssh_private_key. this lets the program connect to EC2. if theaccess_key_idand/orsecret_access_keyare not found in~/.ec2utils.conf, the search will use the ACCOUNT_NAME to look for a matching section[profile ACCOUNT_NAME]in~/.aws/configor[ACCOUNT_NAME]in~/.aws/credentials.--access-idAWS_ACCESS_KEY β specifies the AWS access key and overrides the value given for the account with theaccess_key_idin the configuration file.--deprecation-dateYYYYMMDD β specifies the date when the image is considered deprecated. this parameter is optional, and if it's not provided it will default to the date on which the program is executed. ποΈ-d,--deprecation-periodNUMBER_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 deprecation date and forms the value for theRemoval datetag in the formatYYYYMMDD. 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. the "look but don't touch" of options, truly.-f,--fileCONFIG_FILE β specifies the configuration file to use. the default is~/.ec2utils.conf.--image-idAMI_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-nameIMAGE_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-fragIMAGE_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-matchREGEX β 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-typehvm|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. all boxes must be ticked, no shortcuts π--public-onlyβ consider only images that are public as a replacement or for deprecation purposes.--replacement-idAMI_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 theReplacement imagetag in the formAMI_ID -- IMAGE_NAME. one of--replacement-id,--replacement-name,--replacement-name-frag, or--replacement-name-match, can be specified (optional).--replacement-nameIMAGE_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-idoption. the image name and the dynamically determined AMI ID are used in combination to form the value for theReplacement imagetag in the formAMI_ID -- IMAGE_NAME. one of--replacement-id,--replacement-name,--replacement-name-frag, or--replacement-name-match, can be specified (optional).--replacement-name-fragIMAGE_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 theReplacement imagetag in the formAMI_ID -- IMAGE_NAME. one of--replacement-id,--replacement-name,--replacement-name-frag, or--replacement-name-match, can be specified (optional).--replacement-name-matchREGEX β 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 theReplacement imagetag in the formAMI_ID -- IMAGE_NAME. one of--replacement-id,--replacement-name,--replacement-name-frag, or--replacement-name-match, can be specified (optional).-r,--regionsEC2_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, so 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. iykyk π-s,--secret-keyAWS_SECRET_KEY β specifies the AWS secret access key and overrides the value given for the account with thesecret_access_keyin the configuration file.--verboseβ print extra output about the operations performed to STDOUT.--versionβ print the version of he program π (the typo is canon, it's in the original, we don't fix, we preserve π«Ά)
π EXAMPLE π
ec2deprecateimg --account example --image-name-match v15 --image-virt-type hvm --replacement-name exampleimage_v16
this 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. ate and left no crumbs π₯
π AUTHOR π
SUSE Public Cloud Team
and that's the whole page, bestie β no skips, no cuts, every flag accounted for π this was ec2deprecateimg(1), living in the General Commands Manual, and it's a wrap πβ¨π
π¦ where this page comes from
- opensuse-leap 16.0: python313-ec2imgutils 10.0.3-bp160.1.11 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms