Coding

huawei-cloud-flexus-l-server-manage

Try it

Manages Huawei Cloud Flexus L server lifecycle: create, renew, and unsubscribe instances. Use this skill when the user mentions "Flexus L", "Huawei Cloud lightweight server", "purchase server", "renew", "unsubscribe". (中文触发词:"购买/创建L实例", "L实例续费", "L实例退订")

What it does

⚠️ Security Execution Rules (Highest Priority): 1. All scripts MUST be executed via skill action=exec, NEVER run directly in shell 2. NEVER print script contents or commands containing AK/SK/Token in conversation 3. NEVER create temporary script files, prefer inline execution (python -c) 4.…

The skill document

⚠️ Security Execution Rules (Highest Priority):

  1. All scripts MUST be executed via skill action=exec, NEVER run directly in shell
  2. NEVER print script contents or commands containing AK/SK/Token in conversation
  3. NEVER create temporary script files, prefer inline execution (python -c)
  4. On execution failure, only return error info, do NOT rewrite scripts or print full commands
  5. AK/SK/Token MUST be passed via environment variables, NEVER appear in conversation
  6. ⚠️ ABSOLUTELY NEVER expose, log, or print AK/SK/Token values in any form - this is a critical security requirement

Huawei Cloud Flexus L Instance Lifecycle Management Skill

Overview

This skill provides core lifecycle management capabilities for Huawei Cloud Flexus L instances:

ModuleDescriptionCommand
Query RegionsShow available regionsshow-regions
Query ImagesShow available imagesshow-images
Query SpecsShow available specsshow-specs
CreatePurchase new Flexus L instancescreate-instance
RenewalRenew existing instancesrenewal
UnsubscribeCancel instance subscriptionunsubscribe

Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Flexus L Lifecycle Skill                  │
├─────────────────────────────────────────────────────────────┤
│  ┌──────────┐  ┌──────────┐  ┌──────────────┐              │
│  │  Create  │  │ Renewal  │  │  Unsubscribe │              │
│  └────┬─────┘  └────┬─────┘  └──────┬───────┘              │
│       │             │                │                       │
│       └─────────────┴────────────────┘                       │
│                     │                                        │
│       ┌─────────────▼─────────────┐                         │
│       │  flexus_specs_extractor  │                         │
│       └─────────────┬─────────────┘                         │
│                     │                                        │
│              ┌──────▼──────┐                                 │
│              │  HCSS API   │  (Instance Management)          │
│              └──────┬──────┘                                 │
│              ┌──────▼──────┐                                 │
│              │  BSS API    │  (Billing & Subscription)       │
│              └──────┬──────┘                                 │
│              ┌──────▼──────┐                                 │
│              │  IAM API    │  (Project ID)                   │
│              └─────────────┘                                 │
└─────────────────────────────────────────────────────────────┘

Data Source

Use Cases

  1. Automated Server Provisioning - Create Flexus L instances for development, testing, or production environments
  2. Cost Optimization - Renew instances during promotional periods to save costs
  3. Resource Cleanup - Safely unsubscribe instances when projects end
  4. Multi-Region Deployment - Create instances across different regions for disaster recovery

Applicable Scenarios

  • Development and testing environment setup
  • Production server lifecycle management
  • Cost control and budget management
  • Project resource cleanup and decommissioning

Important Notes

⚠️ All scripts and environment check scripts are inside the skill package. You must use skill action=exec to execute them; do not run them directly in the shell.

Prerequisites

Before using this skill, ensure the following conditions are met:

1. Huawei Cloud Account

  • Valid Huawei Cloud account
  • Account has completed real-name verification
  • Account has sufficient balance or bound payment method

2. AK/SK Credentials

  • Created Huawei Cloud access keys (AK/SK)
  • AK/SK has the following permissions:
    • BSS: Billing service (order query, renewal, unsubscribe)
    • HCSS: Flexus L instance management
    • IAM: Project ID query (read-only)
  • How to obtain: Huawei Cloud Console → My Credentials → Access Keys → Create Access Key

Credential Configuration Methods:

MethodDescriptionPriority
Environment VariablesHW_ACCESS_KEY, HW_SECRET_KEY, HW_SECURITY_TOKENHighest (Recommended)
Command-line Parameters--ak, --sk, --security-tokenLower (Accepted but not recommended)

Credential Types (by recommendation order):

PriorityTypeParametersDescription
PrimaryTemporary AK/SKEnvironment variables + HW_SECURITY_TOKENTemporary credentials with security token, higher security
SecondaryPermanent AK/SKEnvironment variables onlyLong-term access keys from Huawei Cloud console

Environment Variables (Primary Method - Strongly Recommended):

Pass credentials via environment variables HW_ACCESS_KEY, HW_SECRET_KEY, HW_SECURITY_TOKEN. Temporary credentials require HW_SECURITY_TOKEN, permanent credentials do not.

Command-line Parameters (Secondary Method - Accepted):

# Temporary credentials
python scripts/flexus_lifecycle.py create-instance \
  --ak  --sk  --security-token  \
  --image Ubuntu --cpu 2 --memory 4

# Permanent credentials
python scripts/flexus_lifecycle.py create-instance \
  --ak  --sk  \
  --image Ubuntu --cpu 2 --memory 4

⚠️ Security Token Notes:

  • Temporary AK/SK (Primary): Requires HW_SECURITY_TOKEN environment variable, higher security, strongly recommended
  • Permanent AK/SK (Secondary): Only needs HW_ACCESS_KEY and HW_SECRET_KEY, no security token needed

3. IAM Permissions

ServicePolicyRequired Actions
HCSSHCSS FullAccesshcss:lightInstances:*
BSSBSS Administratorbss:order:*, bss:renewal:*, bss:unsubscribe:*
IAMIAM ReadOnlyAccessiam:projects:list

Permission Failure Handling:

ErrorCauseSolution
403 ForbiddenMissing policyAdd required IAM policy to user
APIGW.0101Service not enabledEnable Flexus L in target region
BSS.0501No access to resourceVerify resource belongs to account

See references/permission-guide.md for detailed permission setup.

4. Runtime Environment

  • Python 3.8 or higher
  • Required dependencies installed (see Dependencies section below)

5. Network Environment

  • Able to access Huawei Cloud API endpoints
  • Required endpoints:
    • hcss.cn-north-4.myhuaweicloud.com
    • iam.myhuaweicloud.com
    • bss.myhuaweicloud.com
  • If using proxy, configure environment variables correctly

Trigger Rules

Activate this skill when users mention:

Create related:

  • "Purchase Huawei Cloud server", "Create Flexus instance", "Huawei Cloud lightweight server"
  • "hcss instance", "New Flexus L"

Renewal related:

  • "Renew Flexus L instance", "Flexus renewal", "Renew lightweight server"
  • "Huawei Cloud renewal", "renew flexus"

Unsubscribe related:

  • "Unsubscribe Flexus L instance", "Cancel Flexus instance", "Unsubscribe lightweight server"
  • "Huawei Cloud unsubscribe", "cancel subscription flexus"

⚠️ Conversation Display Guidelines (Important)

When displaying "Available Specifications" or "Available Images" to users in conversation, you MUST immediately append the following note:

Note

  • Spec codes vary by region and image version. Please refer to the official documentation Appendix 1 (spec codes for each image type) and Appendix 2 (spec details for each code) before purchasing.
  • Official Link:

This applies to all conversation scenarios, including dry-run previews.


Security Notes

⚠️ AK/SK Security Requirements (CRITICAL):

  • Environment Variables (Primary - Strongly Recommended): HW_ACCESS_KEY, HW_SECRET_KEY, HW_SECURITY_TOKEN
  • Command-line Parameters (Secondary - Accepted): --ak, --sk, --security-token
  • Priority: Environment variables > Command-line parameters
  • Security Token: Recommended - Temporary credentials have higher security

⚠️ ABSOLUTE SECURITY RULES - NEVER VIOLATE:

  1. NEVER print, log, or display AK/SK/Token values in any form
  2. NEVER include AK/SK/Token in error messages or debug output
  3. NEVER store AK/SK/Token in files or configuration
  4. NEVER transmit AK/SK/Token over insecure channels
  5. When command-line parameters are used, they MUST be masked in any output

Credential Usage (by recommendation order):

# Primary: With security token (temporary credentials, higher security)
BasicCredentials(ak, sk).with_security_token(security_token)

# Secondary: Without security token (permanent credentials)
BasicCredentials(ak, sk)

Core Commands

CommandFunctionRequired ParamsOptional Params
show-regionsShow available regionsNoneNone
show-imagesShow available imagesNone--region
show-specsShow available specs--image--region
create-instanceCreate instance--ak, --sk, --security-token (recommended)--region, --image, --plan-spec, --cpu, --memory, --period-num, --period-type, --instance-name, --auto-renew, --auto-pay, --dry-run, --confirm
renewalRenew instance--ak, --sk, --security-token (recommended), --resource-ids--period-num, --period-type, --auto-pay, --dry-run, --confirm
unsubscribeUnsubscribe instance--ak, --sk, --security-token (recommended), --resource-ids--type, --reason, --dry-run, --confirm

Parameter Confirmation

Required Parameter Validation:

ParameterDescriptionValidation Rule
--akHuawei Cloud Access Key IDNon-empty (or set HW_ACCESS_KEY env var)
--skHuawei Cloud Secret Access KeyNon-empty (or set HW_SECRET_KEY env var)
--security-tokenSecurity TokenRecommended (or set HW_SECURITY_TOKEN env var)
--resource-idsResource IDsNon-empty, comma-separated for multiple
--imageImage nameFormat: name:version, e.g. Ubuntu:22.04
--regionRegion IDMust be in supported regions list

Parameter Relationships:

Parameter GroupDescription
--plan-spec vs --cpu/--memoryChoose one; --plan-spec takes priority; if not specified, auto-match based on --cpu/--memory
--dry-run vs --confirmChoose one or neither; --dry-run previews only, --confirm skips confirmation, neither triggers interactive confirmation

Default Values:

ParameterDefaultDescription
--regioncn-north-4North China - Beijing 4
--imageUbuntuUbuntu system image
--period-num1Purchase/renew for 1 month
--period-typemonthMonthly billing
--type (unsubscribe)1Immediate unsubscribe
--auto-renewTrueEnable auto renewal
--auto-payTrueAuto payment

⚠️ Mandatory Confirmation Mechanism

Creation, renewal, and cancellation operations involve actual costs and must be executed only after explicit confirmation from the user!

Confirmation methods (choose one):

  1. Dialog confirmation: Reply "confirm" or "yes" in conversation
  2. Command-line confirmation: Use --confirm flag
  3. Dry-run preview: Use --dry-run to preview without executing

⚠️ Failure Handling Rule:

When user confirms the preview order and the purchase fails:

  • Only make ONE request - do not retry automatically
  • Return the failure reason to the user
  • Guide user to repurchase - let user decide next steps
  • NEVER change parameters (region, spec, image, etc.) without user's explicit request

Usage

Basic Command Format

python scripts/flexus_lifecycle.py  [options]

Global Parameters

ParameterDescriptionRequiredEnvironment Variable
--akHuawei Cloud Access Key IDYes (or env var)HW_ACCESS_KEY
--skHuawei Cloud Secret Access KeyYes (or env var)HW_SECRET_KEY
--security-tokenSecurity TokenRecommendedHW_SECURITY_TOKEN
--regionRegion ID (default: cn-north-4)No-
--dry-runDry run, don't actually executeNo-
--confirmForce confirmation, skip interactiveNo-

Credential Configuration Examples

Method 1: Using Environment Variables (Primary - Strongly Recommended)

python scripts/flexus_lifecycle.py create-instance --image Ubuntu --cpu 2 --memory 4

Method 2: Using Command-line Parameters (Secondary - Accepted)

# Temporary credentials
python scripts/flexus_lifecycle.py create-instance \
  --ak  --sk  --security-token  \
  --image Ubuntu \
  --cpu 2 \
  --memory 4

# Permanent credentials
python scripts/flexus_lifecycle.py create-instance \
  --ak  --sk  \
  --image Ubuntu \
  --cpu 2 \
  --memory 4

Module Details

0️⃣ Query Functions

Show available regions:

python scripts/flexus_lifecycle.py show-regions

Show available images for a region:

python scripts/flexus_lifecycle.py --region cn-north-4 show-images

Show available specs for an image:

python scripts/flexus_lifecycle.py --region cn-north-4 show-specs --image Ubuntu

1️⃣ Create Instance (create-instance)

Purchase new Flexus L instances, supports Windows/Linux.

python scripts/flexus_lifecycle.py create-instance \
  --region cn-north-4 \
  --image Ubuntu \
  --cpu 2 \
  --memory 4

Method 2: Specify Spec

python scripts/flexus_lifecycle.py create-instance \
  --region cn-north-4 \
  --image Ubuntu \
  --plan-spec hf.medium.1.linux

Method 3: Use Default Spec

python scripts/flexus_lifecycle.py create-instance \
  --region cn-north-4 \
  --image Ubuntu

Create Parameters:

ParameterDescriptionDefault
--imageImage nameUbuntu
--plan-specInstance specificationAuto-match or config default
--cpuCPU cores (for auto-match)-
--memoryMemory GB (for auto-match)-
--period-numPurchase duration (months)1
--period-typePeriod type (month/year)month
--instance-nameInstance nameAuto-generated
--auto-renewAuto renewalTrue
--auto-payAuto paymentTrue

Available Specifications Reference:

See references/image-specs-guide.md for detailed specs.


2️⃣ Renewal Instance (renewal)

Renew existing Flexus L instances.

# Preview renewal (recommended)
python scripts/flexus_lifecycle.py renewal \
  --resource-ids  \
  --period-num 1 \
  --period-type month \
  --dry-run

# Confirm renewal
python scripts/flexus_lifecycle.py renewal \
  --resource-ids  \
  --period-num 6 \
  --period-type month \
  --confirm

# Renew multiple instances
python scripts/flexus_lifecycle.py renewal \
  --resource-ids id1,id2,id3 \
  --period-num 1 \
  --period-type year \
  --confirm

Renewal Parameters:

ParameterDescriptionDefault
--resource-idsResource IDs (comma-separated)Required
--period-numRenewal period count1
--period-typePeriod type (month/year)month
--auto-payAuto paymentTrue

3️⃣ Unsubscribe Instance (unsubscribe)

Cancel Flexus L instance subscription.

# Preview unsubscribe (recommended)
python scripts/flexus_lifecycle.py unsubscribe \
  --resource-ids  \
  --dry-run

# Immediate unsubscribe (type 1)
python scripts/flexus_lifecycle.py unsubscribe \
  --resource-ids  \
  --type 1 \
  --confirm

# Expiry unsubscribe (type 2)
python scripts/flexus_lifecycle.py unsubscribe \
  --resource-ids  \
  --type 2 \
  --confirm

# Batch unsubscribe
python scripts/flexus_lifecycle.py unsubscribe \
  --resource-ids id1,id2,id3 \
  --type 1 \
  --reason "Project ended" \
  --confirm

Unsubscribe Parameters:

ParameterDescriptionDefault
--resource-idsResource IDs (comma-separated)Required
--typeUnsubscribe type (1=immediate, 2=expiry)1
--reasonUnsubscribe reasonNone

Unsubscribe Types:

TypeDescriptionEffect
1Unsubscribe resource and renewed periodsResource stops immediately, pro-rated refund
2Only unsubscribe renewed periodsResource continues until expiry

Available Regions

⚠️ Note: Flexus L instances currently support only the following regions:

Region IDRegion NameSpec Prefix
cn-north-4North China - Beijing 4hf.*
cn-east-3East China - Shanghai 1hf.*
cn-south-1South China - Guangzhouhf.*
cn-southwest-2Southwest China - Guiyang 1ahf.*
ap-southeast-1Hong Kong, Chinahf.*
ap-southeast-3Asia Pacific - Singaporehf.*

Dependencies

Python Dependencies

Install via pip:

pip install requests huaweicloudsdkcore huaweicloudsdkbss

Or use pyproject.toml:

cd scripts
pip install -e .

pyproject.toml

[project]
name = "flexus-lifecycle"
version = "1.0.0"
dependencies = [
    "requests>=2.28.0",
    "huaweicloudsdkcore>=3.0.0",
    "huaweicloudsdkbss>=3.0.0",
]

File Structure

skills/huawei-cloud-flexus-l-server-manage/
├── SKILL.md                    # This file
├── scripts/
│   ├── flexus_lifecycle.py     # Main lifecycle script
│   ├── flexus_specs_extractor.py  # Dynamic specs fetcher
│   └── pyproject.toml          # Dependencies
└── references/
    ├── api-reference.md        # API reference
    ├── iam-policies.md         # IAM policies
    ├── image-specs-guide.md    # Image specs guide
    ├── permission-guide.md     # Permission setup
    └── troubleshooting.md      # Troubleshooting

Error Handling

Common Errors

Error CodeDescriptionSolution
401 UnauthorizedInvalid AK/SKVerify AK/SK is correct and active
403 ForbiddenPermission deniedAdd required IAM policies
APIGW.0101API not foundCheck service is enabled in region
APIGW.0301Signature verification failedCheck SK is correct
BSS.0501Resource not foundVerify resource ID is correct
BSS.0502Resource state invalidCheck resource status
400 Bad RequestInvalid parametersCheck spec/image compatibility

See references/troubleshooting.md for detailed error handling.


References

  • API Reference
  • IAM Policies
  • Image Specs Guide
  • Permission Guide
  • Troubleshooting

External References


Related skills

Generate and edit Draw.io, Mermaid, and Excalidraw diagrams from natural language using a structured JSON spec.

by nssa.io1.0k installs47 stars

Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.

by johnpatternai22 installs8 stars

Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.

by Iván559 installs18 stars

Find why your productivity system keeps failing, then apply the smallest fix — capacity math, bottleneck routing, durable local notes.

by Iván855 installs69 stars

Fetch raw ad creative, app, ranking, and revenue data from AdMapix as structured JSON.

by fly0pants4.3k installs296 stars

Run Git operations — commits, branches, merges, rebases, conflict resolution, and recovery — with safety rules enforced.

by Iván535 installs31 stars

More from huaweicloud-skills-team

Browse all skills

Search the Huawei Cloud skill catalog by keyword or category, then install the matching skill.

by huaweicloud-skills-team

Read-only queries of Huawei Cloud resources, specs, and images via local Python scripts.

by huaweicloud-skills-team

Provides guidance for Huawei Cloud KooCLI command-line tool operations. Covers KooCLI installation, IAM authentication configuration, access credential configuration, command construction, common error troubleshooting. Use this skill when users ask about any cloud-related services or wants to operate Huawei Cloud services from the terminal. Triggers: Huawei Cloud, huaweiyun, "华为云","华为cli", "命令行", KooCLI, hcloud, huaweiyunCLI, Huawei Cloud command line, OBS, ECS, VPC, "云", yun, huaweiyun tool, huawei tool, "华为云工具", "云工具", "工具"

by huaweicloud-skills-team2 installs

One-click deployment of JiuwenSwarm multi-Agent collaboration platform on Huawei Cloud Flexus L instances. Usage scenarios: When users need to quickly deploy JiuwenSwarm/JiuwenClaw on Huawei Cloud Flexus L instances, when they need to automatically create cloud instances and deploy AI Agent platforms, when they need to configure model APIs and message channels (Xiaoyi/Feishu/DingTalk). Automatically create instances, deploy applications via COC, configure models and message channels. Trigger keywords: JiuwenSwarm deployment, JiuwenClaw deployment, 九问Swarm部署, 九问Claw部署, 一键部署JiuwenSwarm, AI智能体平台部署, 部署九问Swarm, 部署九问Claw,云服务器部署AI平台.

by huaweicloud-skills-team2 installs

Provides access guide for Huawei Cloud Graph Database GES service. Covers Cypher queries, GQL queries, schema/label management, summary info queries, graph data editing and more. Use this skill when users want to operate Huawei Cloud graph database GES service via terminal.

by huaweicloud-skills-team2 installs