Lost resources management commands
General description
MDBCI can find and destroy unused cloud resources, such as:
- GCP and AWS instances
- GCP disks
- AWS volumes
- AWS security groups
- AWS key pairs
List unused resources
mdbci list-cloud-resources
This command lists in a table form the names of the unused resources and their creation dates. The resources are grouped by their type and provider.
Options
--output-file FILENAMEThe name of the JSON report file with the list of resources that will be generated by MDBCI. If not specified, the list will be written to standard output.--hours NUMBER_OF_HOURSThe number of hours after which a resource is considered unused. If not specified, all active cloud resources will be listed.--jsonIf specified, the list of instances will be written to the standard output in a JSON format instead of a table.
A resource is considered unused if it was created (or generated) earlier than NUMBER_OF_HOURS hours ago an is not currently being used by any VM.
The command ends with an error if any resource is present, no otherwise
Clean unused resources
mdbci clean-unused-resources --resources-list PATH_TO_REPORT_FILE
This command destroys the cloud resources.
Options
- (Required)
--resources-list PATH_TO_REPORT_FILEThe name of the JSON report file with the list of resources that will be destroyed.
Report file format
{
"instances": {
"aws": [
{
"node_name": "somename", // Required to destroy
"launch_time": "2022-04-21T19:31:45+00:00"
}
],
"gcp": [
{
"type": "c2-standard-4",
"node_name": "mdbci-3uwpyr1v-1669724674-build", // Required to destroy
"launch_time": "2022-11-29T12:24:54+00:00",
"zone": "us-central1-c", // Required to destroy
"path": "/path/to/config",
"username": "username"
}
]
},
"disks": {
"aws": [
{
"name": "volume-name", // Required to destroy
"zone": "eu-west-1-a",
"creation_date": "2022-11-02T08:29:31-07:00"
}
],
"gcp": [
{
"name": "mdbci-ezmlb5cv-1661161923-xpand-002-disk", // Requred to destroy
"zone": "europe-north1-a", // Required to destroy
"creation_date": "2022-11-02T08:29:31-07:00"
}
]
},
"key_pairs": [
{
"name": "mdbci-ezmlb5cv-1661161923-xpand-002-key", // Required to destroy
"creation_date": "2022-11-02T08:29:31-07:00"
}
],
"security_groups": [
{
"group_id": "sg-0228b331c2a7be875", // Required to destroy
"configuration_id": "mdbci-ezmlb5cv-1661161923",
"creation_date": "2022-11-02T08:29:31-07:00"
}
]
}
Fields required to destroy a resource are marked. Other fields are optional and contain additional information about the resources.