Cloud Custodian - Huawei Cloud Support
This is a plugin to Cloud Custodian that adds Huawei Cloud support.
Install Cloud Custodian and Huawei Cloud Plugin
The Huawei Cloud provider must be installed as a separate package in addition to c7n.
$ pip install c7n_huaweicloud
Write your first policy
Cloud Custodian policies are expressed in YAML and include the following:
- The type of resource to run the policy against
- Filters to narrow down the set of resources
- Actions to take on the filtered set of resources
Our first policy filters compute instance of a specific name, then adds the tag mark_deletion: true.
Create a file named custodian.yml with the following content.
policies:
- name: filter-for-encrypted-volume
resource: huaweicloud.evs-volume
filters:
- type: value
key: metadata.__system__encrypted
value: "0"
actions:
- delete
Run your policy
export HUAWEI_ACCESS_KEY_ID="YOUR_ACCESS_KEY_ID"
export HUAWEI_SECRET_ACCESS_KEY="YOUR_SECRET_ACCESS_KEY"
export HUAWEI_DEFAULT_REGION="YOUR_REGION"
custodian run --output-dir=. custodian.yml
If successful, you should see output like the following on the command line::
2025-03-14 16:44:00,553 - custodian.policy - INFO - policy:filter-for-encrypted-volume resource:huaweicloud.volume region: count:1 time:0.92
2025-03-14 16:44:00,771 - custodian.huaweicloud.resources.volume - INFO - Received Job ID:90f0aed1b4ee443d80dc3faddc543ad9
2025-03-14 16:44:00,771 - custodian.policy - INFO - policy:filter-for-encrypted-volume action:volumedelete resources:1 execution_time:0.22
You can find a new filter-for-encrypted-volume under --output-dir option value directory with a log and a resources.json file.
Links
Metadata
Release files for c7n_huaweicloud 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| c7n_huaweicloud-0.1.1.tar.gz | 88.2 kB | Without provenance | Details for c7n_huaweicloud-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| c7n_huaweicloud-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for c7n_huaweicloud-0.1.1-py3-none-any.whl |
Total release size: 205.4 kB
Release files / c7n_huaweicloud-0.1.1.tar.gz
| Download URL | c7n_huaweicloud-0.1.1.tar.gz |
|---|---|
| Size | 88.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a706810b662b816840e16b106d2c4764607a69654f237b4136537d71dd1a090d
|
|
BLAKE2b-256 checksum How to use checksums |
82d2cbfb02d5d423c1daecb1661682b157e1a88ac336246ac0ae8a4316c50b84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.3 Linux/6.8.0-49-generic
|
Release files / c7n_huaweicloud-0.1.1-py3-none-any.whl
| Download URL | c7n_huaweicloud-0.1.1-py3-none-any.whl |
|---|---|
| Size | 117.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
01687cce272853334144bb5865bc590453c6068ddb53db481e86eb3d4343e499
|
|
BLAKE2b-256 checksum How to use checksums |
8e5d9a825f74b09b38984197d04b565f7f854f224c7e18164f16c3c0cae57765
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.3 Linux/6.8.0-49-generic
|
Security for c7n_huaweicloud 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.