Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Auto Scaling/ API Reference/ Application Examples/ Example 1: Creating an AS Configuration

Example 1: Creating an AS Configuration

Updated on 2022-10-08 GMT+08:00

Scenarios

This section describes how to create an AS configuration by calling APIs. For details, see Calling APIs.

An AS configuration defines the specifications of the ECSs to be added to an AS group. The specifications include the ECS flavor, image, and disk size. You can use specifications of an existing ECS or create an AS configuration.

Constraints

  • The AS configuration is decoupled from the AS group. An AS configuration can be used by multiple AS groups.
  • Up to 100 AS configurations per account can be created by default.

Involved APIs

To create an AS configuration, you need to perform several operations, such as querying a user token, ECS flavors, and images. The following APIs are required:

Procedure

  1. Determine the user token that can be used to authenticate the calling of other APIs.

    1. View the user token. For details, see Obtaining a User Token.
    2. Obtain the value of X-Subject-Token in the response header.

  2. Determine the ECS flavor.

    1. View ECS flavors. For details, see Querying Details About ECS Flavors.
    2. Select a flavor based on site requirements and record the flavor ID.

  3. Determine the image.

    1. View images. For details, see Querying Images.
    2. Select an image based on site requirements and record the image ID.

  4. Set the login mode to Key pair.

    1. View SSH key pairs. For details, see Querying SSH Key Pairs.
    2. Select a key pair as required and record the key pair name.

  5. Create an AS configuration using the flavor and image you specify.

    • API

      URI format: POST /autoscaling-api/v1/{project_id}/scaling_configuration

      For details about API request parameters, see Creating an AS Configuration.

    • Example request

      POST: https://{Endpoint}/autoscaling-api/v1/0605767c2e80d5762fd0c0146a10aaf2/scaling_configuration

      Obtain {endpoint} from Regions and Endpoints.

      Body:

      { 
          "scaling_configuration_name": "as-config-tlzq", 
          "instance_config": { 
              "flavorRef": "s3.xlarge.4", 
              "imageRef": "627a1223-2ca3-46a7-8d5f-7aef22c74ee6", 
              "disk": [ 
                  { 
                      "size": 40, 
                      "volume_type": "SATA", 
                      "disk_type": "SYS" 
                  } 
              ], 
              "key_name": "100vm_key",
              "multi_flavor_priority_policy": "PICK_FIRST"
          } 
      }
    • Example response
      {
          "scaling_configuration_id": "f8327883-6a07-4497-9a61-68c03e8e72a2"
      }

  6. Verify the AS configuration creation.

    • API

      URI format: GET /autoscaling-api/v1/{project_id}/scaling_configuration/{scaling_configuration_id}

      For details, see Querying an AS Configuration.

    • Example request

      GET: https://{Endpoint}/autoscaling-api/v1/0605767c2e80d5762fd0c0146a10aaf2/scaling_configuration/f8327883-6a07-4497-9a61-68c03e8e72a2

      where

      f8327883-6a07-4497-9a61-68c03e8e72a2 is the UUID of the created AS configuration.

      Obtain {endpoint} from Regions and Endpoints.

    • Example response
      {
          "scaling_configuration": {
              "tenant": "0605767c2e80d5762fd0c0146a10aaf2",
              "scaling_configuration_id": "f8327883-6a07-4497-9a61-68c03e8e72a2",
              "scaling_configuration_name": " config_name_1",
              "instance_config": {
                  "disk": [
                      {
                          "size": 40,
                          "volume_type": "SATA",
                          "disk_type": "SYS"
                      },
                      {
                          "size": 100,
                          "volume_type": "SATA",
                          "disk_type": "DATA"
                      }
                  ],
                  "adminPass": "***",
                  "personality": null,
                  "instance_name": null,
                  "instance_id": null,
                  "flavorRef": "103",
                  "imageRef": "627a1223-2ca3-46a7-8d5f-7aef22c74ee6",
                  "key_name": "keypair01",
                  "public_ip": null,
                  "user_data": null,
                  "metadata": {},
                  "security_groups": null,
                  "multi_flavor_priority_policy": "PICK_FIRST"
              },
              "create_time": "2015-07-23T01:04:07Z"
          }
      }

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback