delete¶
Deletes one or more Amazon Machine Images on AWS from specified sources.
This command gets the AMIs from specified source, checks the image presence in metadata service (e.g. RHSM) and makes image invisible in this service. This is followed by deletion of image and related snapshot in AWS.
usage: pubtools-ami-delete [-h] [--debug] [--aws-access-id AWS_ACCESS_ID]
[--aws-secret-key AWS_SECRET_KEY]
[--rhsm-url RHSM_URL] [--rhsm-cert RHSM_CERT]
[--rhsm-key RHSM_KEY]
[--aws-provider-name AWS_PROVIDER_NAME]
[--retry-wait RETRY_WAIT]
[--max-retries MAX_RETRIES] [--keep-snapshot]
[--dry-run] [--limit LIMIT [LIMIT ...]]
source [source ...]
Named Arguments¶
- --debug, -d
Show debug logs; can be provided up to three times to enable more logs
Default: 0
AWS Service¶
- --aws-access-id
The AWS Service ID or Login to access the service (or set AWS_ACCESS_ID environment variable)
Default: “”
- --aws-secret-key
The AWS Service key to access the service (or set AWS_SECRET_KEY environment variable)
Default: “”
RHSM service¶
- --rhsm-url
Base URL of the RHSM API
- --rhsm-cert
RHSM API certificate path (or set RHSM_CERT environment variable)
- --rhsm-key
RHSM API key path (or set RHSM_KEY environment variable)
AMI common options¶
- source
source location of the staged AMIs with the source type. e.g. staged:/path/to/stage/ami or errata:https://errata.example.com?errata=RHBA-2020:1234 or pub:https://pub.example.com?task_id=125222
- --aws-provider-name
AWS provider e.g. AWS, ACN (AWS China), AGOV (AWS US Gov)
Default: “AWS”
- --retry-wait
duration to wait in sec before retrying action on AWS
Default: 30
- --max-retries
number of retries on failure with action on AWS
Default: 4
AMI delete options¶
- --keep-snapshot
Do not delete snapshot from AWS
Default: False
- --dry-run
Skip destructive actions on rhsm or AWS
Default: False
- --limit
Only remove the specified AMIs by AMI image id
Example¶
A typical invocation of delete would look like this:
pubtools-ami-delete \
--rhsm-url https://rhsm.example.com \
--aws-provider-name awstest \
--aws-access-id access_id \
--aws-secret-key secret_key \
pub:https://pub.example.com?task_id=123456
All the AMIs in the given source path will be made invisible in RHSM and then deleted on AWS with related snapshots.
Example: keep snapshots¶
Running delete while keeping snapshots untouched.
pubtools-ami-delete \
--rhsm-url https://rhsm.example.com \
--keep-snapshot \
--aws-provider-name awstest \
--aws-access-id access_id \
--aws-secret-key secret_key \
pub:https://pub.example.com?task_id=123456
Example: dry-run¶
Running dry-run delete - no destructive actions happen, expected actions are logged.
pubtools-ami-delete \
--rhsm-url https://rhsm.example.com \
--dry-run \
--aws-provider-name awstest \
--aws-access-id access_id \
--aws-secret-key secret_key \
pub:https://pub.example.com?task_id=123456