当前位置: 首页 > Skill >

huawei-cloud-flexus-l-server-manage

huawei-cloud-flexus-l-server-manage

huawei-cloud-flexus-l-server-manage

管理华为云Flexus L实例生命周期,包括创建、续费、退订。当用户提及Flexus L或华为云时使用此技能。

1.0.0 2026.11.27 712
获取Skill文件查看使用说明
作 者:江景 许可证: 更新时间:2026.11.27
本文目录展开

⚠️ 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:

Module Description Command
Query Regions Show available regions show-regions
Query Images Show available images show-images
Query Specs Show available specs show-specs
Create Purchase new Flexus L instances create-instance
Renewal Renew existing instances renewal
Unsubscribe Cancel instance subscription unsubscribe

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

  • Region, Image, Spec Information: Dynamically fetched from official documentation, no local config file needed
  • Official Documentation: https://support.huaweicloud.com/api-flexusl/create_instance_0001.html
  • On-Demand Fetch: Automatically fetches latest data when executing show-regions, show-images, show-specs, create-instance

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:

Method Description Priority
Environment Variables HW_ACCESS_KEY, HW_SECRET_KEY, HW_SECURITY_TOKEN Highest (Recommended)
Command-line Parameters --ak, --sk, --security-token Lower (Accepted but not recommended)

Credential Types (by recommendation order):

Priority Type Parameters Description
Primary Temporary AK/SK Environment variables + HW_SECURITY_TOKEN Temporary credentials with security token, higher security
Secondary Permanent AK/SK Environment variables only Long-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 <AK> --sk <SK> --security-token <TOKEN> 
  --image Ubuntu --cpu 2 --memory 4

# Permanent credentials
python scripts/flexus_lifecycle.py create-instance 
  --ak <AK> --sk <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

Service Policy Required Actions
HCSS HCSS FullAccess hcss:lightInstances:*
BSS BSS Administrator bss:order:*, bss:renewal:*, bss:unsubscribe:*
IAM IAM ReadOnlyAccess iam:projects:list

Permission Failure Handling:

Error Cause Solution
403 Forbidden Missing policy Add required IAM policy to user
APIGW.0101 Service not enabled Enable Flexus L in target region
BSS.0501 No access to resource Verify 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: https://support.huaweicloud.com/api-flexusl/create_instance_0001.html#create_instance_0001__section1881914176434

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

Command Function Required Params Optional Params
show-regions Show available regions None None
show-images Show available images None --region
show-specs Show available specs --image --region
create-instance Create 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
renewal Renew instance --ak, --sk, --security-token (recommended), --resource-ids --period-num, --period-type, --auto-pay, --dry-run, --confirm
unsubscribe Unsubscribe instance --ak, --sk, --security-token (recommended), --resource-ids --type, --reason, --dry-run, --confirm

Parameter Confirmation

Required Parameter Validation:

Parameter Description Validation Rule
--ak Huawei Cloud Access Key ID Non-empty (or set HW_ACCESS_KEY env var)
--sk Huawei Cloud Secret Access Key Non-empty (or set HW_SECRET_KEY env var)
--security-token Security Token Recommended (or set HW_SECURITY_TOKEN env var)
--resource-ids Resource IDs Non-empty, comma-separated for multiple
--image Image name Format: name:version, e.g. Ubuntu:22.04
--region Region ID Must be in supported regions list

Parameter Relationships:

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

Default Values:

Parameter Default Description
--region cn-north-4 North China - Beijing 4
--image Ubuntu Ubuntu system image
--period-num 1 Purchase/renew for 1 month
--period-type month Monthly billing
--type (unsubscribe) 1 Immediate unsubscribe
--auto-renew True Enable auto renewal
--auto-pay True Auto 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 <command> [options]

Global Parameters

Parameter Description Required Environment Variable
--ak Huawei Cloud Access Key ID Yes (or env var) HW_ACCESS_KEY
--sk Huawei Cloud Secret Access Key Yes (or env var) HW_SECRET_KEY
--security-token Security Token Recommended HW_SECURITY_TOKEN
--region Region ID (default: cn-north-4) No -
--dry-run Dry run, don't actually execute No -
--confirm Force confirmation, skip interactive No -

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 <AK> --sk <SK> --security-token <TOKEN> 
  --image Ubuntu 
  --cpu 2 
  --memory 4

# Permanent credentials
python scripts/flexus_lifecycle.py create-instance 
  --ak <AK> --sk <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.

Method 1: Auto-match Spec (Recommended)

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:

Parameter Description Default
--image Image name Ubuntu
--plan-spec Instance specification Auto-match or config default
--cpu CPU cores (for auto-match) -
--memory Memory GB (for auto-match) -
--period-num Purchase duration (months) 1
--period-type Period type (month/year) month
--instance-name Instance name Auto-generated
--auto-renew Auto renewal True
--auto-pay Auto payment True

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 <resource-id> 
  --period-num 1 
  --period-type month 
  --dry-run

# Confirm renewal
python scripts/flexus_lifecycle.py renewal 
  --resource-ids <resource-id> 
  --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:

Parameter Description Default
--resource-ids Resource IDs (comma-separated) Required
--period-num Renewal period count 1
--period-type Period type (month/year) month
--auto-pay Auto payment True

3️⃣ Unsubscribe Instance (unsubscribe)

Cancel Flexus L instance subscription.

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

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

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

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

Unsubscribe Parameters:

Parameter Description Default
--resource-ids Resource IDs (comma-separated) Required
--type Unsubscribe type (1=immediate, 2=expiry) 1
--reason Unsubscribe reason None

Unsubscribe Types:

Type Description Effect
1 Unsubscribe resource and renewed periods Resource stops immediately, pro-rated refund
2 Only unsubscribe renewed periods Resource continues until expiry

Available Regions

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

Region ID Region Name Spec Prefix
cn-north-4 North China - Beijing 4 hf.*
cn-east-3 East China - Shanghai 1 hf.*
cn-south-1 South China - Guangzhou hf.*
cn-southwest-2 Southwest China - Guiyang 1 ahf.*
ap-southeast-1 Hong Kong, China hf.*
ap-southeast-3 Asia Pacific - Singapore hf.*

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 Code Description Solution
401 Unauthorized Invalid AK/SK Verify AK/SK is correct and active
403 Forbidden Permission denied Add required IAM policies
APIGW.0101 API not found Check service is enabled in region
APIGW.0301 Signature verification failed Check SK is correct
BSS.0501 Resource not found Verify resource ID is correct
BSS.0502 Resource state invalid Check resource status
400 Bad Request Invalid parameters Check spec/image compatibility

See references/troubleshooting.md for detailed error handling.

References

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

External References

  • Flexus L Instance Purchase Guide - Official API Documentation
  • AK/SK Authentication - IAM Authentication Guide
  • Huawei Cloud Console - Resource Management Console

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,034
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,018
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,017
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,013
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,013
Skill 文件
  • SKILL.md
    • Huawei Cloud Flexus L Instance Lifecycle Management Skill
    • Overview
      • Architecture
      • Data Source
      • Use Cases
      • Applicable Scenarios
      • Important Notes
    • Prerequisites
      • 1. Huawei Cloud Account
      • 2. AK/SK Credentials
      • 3. IAM Permissions
      • 4. Runtime Environment
      • 5. Network Environment
    • Trigger Rules
    • ⚠️ Conversation Display Guidelines (Important)
    • Security Notes
    • Core Commands
    • Parameter Confirmation
    • ⚠️ Mandatory Confirmation Mechanism
    • Usage
      • Basic Command Format
      • Global Parameters
      • Credential Configuration Examples
    • Module Details
      • 0️⃣ Query Functions
      • 1️⃣ Create Instance (create-instance)
        • Method 1: Auto-match Spec (Recommended)
        • Method 2: Specify Spec
        • Method 3: Use Default Spec
      • 2️⃣ Renewal Instance (renewal)
      • 3️⃣ Unsubscribe Instance (unsubscribe)
    • Available Regions
    • Dependencies
      • Python Dependencies
      • pyproject.toml
    • File Structure
    • Error Handling
      • Common Errors
    • References
      • External References
  • 项目或源文件

相关 Skill

更多
service-qa-coach service-qa-coach Review support quality for chat, email, phone, social DM, or marketplace service teams. Use when a team needs a QA scorecard, failure-mode analysis, coaching plan, calibration checklist, or service-improvement brief without live ticketing, CRM, or contact-center system access.
高中数学作业批改助手 高中数学作业批改助手 >图片识别 直接读取学生手写作答照片,识别公式、符号、步骤 🧮 自动推导 根据题目自动生成参考答案和评分细则,无需教师预设 📊 逐步给分 每个关键步骤独立评分,体现过程分 📝 结构化报告 输出含识别内容、参考答案、逐步评分、改进建议的完整报告 🗂 批量批改 支持一次性批改多道题,最终汇总得分表
Vibration Analysis Vibration Analysis 分析来自CMS趋势、RMS/峰值、频谱及SCADA报警的风机传动链(主轴、齿轮箱、发电机)振动数据。
Traditional Bone Tool Making Basics Traditional Bone Tool Making Basics Use when you need custom, durable, repairable tools like awls, needles, scrapers, harpoons, or fishing hooks made from local animal bones or antlers and comm...
音频混音工具 音频混音工具 名称:Sound Mixing Tool(标识 sound-mixing-tool) 短简介(≤60字):音乐/音效响度精确对齐 + 融合混音工作流:用 ffmpeg 两段式 loudnorm 把多组素材 LUFS 偏差压到 <0.10,再最小干预融合、导出可进引擎的独立分轨。 标签/关键词:音频混音 响度匹配 LUFS ffmpeg 游戏音频 音效设计 Wwise FMOD 分轨导出 后期处理 触发词:混音 · 响度匹配 · LUFS 对齐 · MIX 版本 · 音乐音效分轨 · 融合 · 不打架 · 不能盖住 适用场景 :游戏音频集成、影视短视频配乐、播客后期