Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

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

Creating an Image

Updated on 2024-03-01 GMT+08:00

Function

This API is used to create a private image. The following methods are supported:

  • Create a system or data disk image from an ECS.
  • Create a system disk image from an external image file uploaded to an OBS bucket.

The API is an asynchronous one. If it is successfully called, the cloud service system receives the request. However, you need to use the asynchronous job query API to query the image creation status. For details, see Querying the Status of an Asynchronous Job.

You cannot export public images (such as Windows, SUSE, Red Hat, Oracle Linux, and Ubuntu) or private images created using these public images.

URI

POST /v2/cloudimages/action

Request

  • Parameters for creating a system or data disk image from an ECS

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Specifies the name of the system disk image. For detailed description, see Image Attributes.

    description

    No

    String

    Provides supplementary information about the image. For details, see Image Attributes. The value contains a maximum of 1024 characters and consists of only letters and digits. Carriage returns and angle brackets (< >) are not allowed. This parameter is left blank by default.

    instance_id

    Yes

    String

    Specifies the ID of the ECS used to create the image.

    To obtain the ECS ID, perform the following operations:

    1. Log in to management console.
    2. Under Computing, click Elastic Cloud Server.
    3. In the ECS list, click the name of the ECS and view its ID.

    data_images

    No

    Array of objects

    Specifies the data disk information to be converted. This parameter is mandatory when the data disk of an ECS is used to create a private data disk image. For details, see Table 1.

    If the ECS data disk is not used to create a data disk image, the parameter is empty by default.

    NOTE:

    When you create a data disk image using a data disk, if other parameters (such as name, description, and tags) in this table have values, the system uses the value of data_images. You cannot specify instance_id.

    tags

    No

    Array of strings

    Lists the image tags. This parameter is left blank by default.

    Use either tags or image_tags.

    image_tags

    No

    Array of objects

    Lists the image tags. This parameter is left blank by default.

    Use either tags or image_tags.

    max_ram

    No

    Integer

    Specifies the maximum memory of the image in the unit of MB.

    min_ram

    No

    Integer

    Specifies the minimum memory of the image in the unit of MB. The default value is 0, indicating that the memory is not restricted.

    Table 1 Data structure description of the data_images field

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Specifies the name of a data disk image.

    volume_id

    Yes

    String

    Specifies the data disk ID.

    description

    No

    String

    Specifies the data disk description.

    tags

    No

    Array of strings

    Specifies the data disk image tag.

  • Parameters for creating an image using an image file uploaded to the OBS bucket

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Specifies the image name. For detailed description, see Image Attributes.

    description

    No

    String

    Provides supplementary information about the image. For detailed description, see Image Attributes. The value contains a maximum of 1024 characters and consists of only letters and digits. Carriage returns and angle brackets (< >) are not allowed. This parameter is left blank by default.

    os_type

    No

    String

    Specifies the OS type.

    The value can be Linux, Windows, or Other.

    os_version

    No

    String

    Specifies the OS version.

    This parameter is valid if an external image file uploaded to the OBS bucket is used to create an image. For its value, see Values of Related Parameters.

    NOTE:

    This parameter is mandatory when the value of is_quick_import is true, that is, a system disk image is imported using the quick import method.

    image_url

    Yes

    String

    Specifies the URL of the external image file in the OBS bucket.

    This parameter is mandatory if an external image file in the OBS bucket is used to create an image. The format is OBS bucket name:Image file name.

    • To obtain an OBS bucket name:
      1. Log in to the management console and choose Storage > Object Storage Service.

        All OBS buckets are displayed in the list.

      2. Filter the OBS buckets by region and locate the target bucket in the current region.
    • To obtain an OBS image file name:
      1. Log in to the management console and choose Storage > Object Storage Service.

        All OBS buckets are displayed in the list.

      2. Filter the OBS buckets by region and locate the target bucket in the current region.
      3. Click the name of the target bucket to go to the bucket details page.
      4. In the navigation pane on the left, choose Objects to display objects in the OBS bucket and then locate the external image file used to create an image.
    NOTE:

    The storage class of the OBS bucket must be Standard.

    min_disk

    Yes

    Integer

    Specifies the minimum size of the system disk in the unit of GB.

    This parameter is mandatory if an external image file in the OBS bucket is used to create an image. The value ranges from 1 GB to 1,024 GB.

    is_config

    No

    Boolean

    Specifies whether automatic configuration is enabled.

    The value can be true or false.

    If automatic configuration is required, set the value to true. Otherwise, set the value to false The default value is false.

    For details about automatic configuration, see Creating a Linux System Disk Image from an External Image File > Registering an External Image File as a Private Image (Linux) in Image Management Service User Guide.

    cmk_id

    No

    String

    Specifies a custom key used for encrypting an image. For its value, see the Key Management Service User Guide.

    tags

    No

    Array of strings

    Lists the image tags. This parameter is left blank by default.

    Use either tags or image_tags.

    image_tags

    No

    Array of objects

    Lists the image tags. This parameter is left blank by default. Use either tags or image_tags.

    max_ram

    No

    Integer

    Specifies the maximum memory of the image in the unit of MB.

    min_ram

    No

    Integer

    Specifies the minimum memory required by the image in the unit of MB. The default value is 0, indicating that the memory is not restricted.

    data_images

    No

    Array of objects

    Specifies the data disk information to be imported.

    An external image file can contain a maximum of three data disks. In this case, one system disk and three data disks will be created.

    For details, see Table 2.

    NOTE:
    • If a data disk image file is used to create a data disk image, the OS type of the data disk image must be the same as that of the system disk image.
    • If other parameters (such as name, description, and tags) in Table 2 are set, the system uses the values in data_images.

    is_quick_import

    No

    Boolean

    Specifies whether to use the quick import method to import a system disk image.

    • If yes, set the value to true.
    • If no, set the value to false.

    For details about the restrictions on quick import of image files, see Importing an Image File Quickly.

    Table 2 Data structure description of the images field

    Parameter

    Mandatory

    Type

    Description

    name

    No

    String

    Specifies the image name.

    For more details, see Image Attributes.

    description

    No

    String

    Provides supplementary information about the image. This parameter is left blank by default.

    The value contains a maximum of 1024 characters and consists of only letters and digits. Carriage returns and angle brackets (< >) are not allowed.

    For more details, see Image Attributes.

    image_url

    Yes

    String

    Specifies the URL of the external image file in the OBS bucket.

    The format is OBS bucket name:Image file name.

    • To obtain an OBS bucket name:
      1. Log in to the management console and choose Storage > Object Storage Service.

        All OBS buckets are displayed in the list.

      2. Filter the OBS buckets by region and locate the target bucket in the current region.
    • To obtain an OBS image file name:
      1. Log in to the management console and choose Storage > Object Storage Service.

        All OBS buckets are displayed in the list.

      2. Filter the OBS buckets by region and locate the target bucket in the current region.
      3. Click the name of the target bucket to go to the bucket details page.
      4. In the navigation pane on the left, choose Objects to display objects in the OBS bucket and then locate the external image file used to create an image.
    NOTE:

    The storage class of the OBS bucket must be Standard.

    min_disk

    Yes

    Integer

    Specifies the minimum size of the data disk.

    Unit: GB

    Value range: 1–2048

    is_quick_import

    No

    Boolean

    Specifies whether an image file is imported quickly to create a data disk image.

    • If yes, set the value to true.
    • If no, set the value to false.

    For details about the restrictions on quick import of image files, see Importing an Image File Quickly.

    tags

    No

    Array of strings

    Lists the image tags. This parameter is left blank by default.

    For detailed parameter descriptions, see Image Tag Data Formats.

    Use either tags or image_tags.

    image_tags

    No

    Array of objects

    Lists the image tags. This parameter is left blank by default.

    For detailed parameter descriptions, see Image Tag Data Formats.

    Use either tags or image_tags.

Example Request

  • Creating a system disk image with parameter tags using an ECS (ID: 877a2cda-ba63-4e1e-b95f-e67e48b6129a)
    POST https://{Endpoint}/v2/cloudimages/action
    {
        "name": "ims_test",
           "description": "Create a system disk image from an ECS",
        "instance_id": "877a2cda-ba63-4e1e-b95f-e67e48b6129a",
        "tags": [
            "aaa.111",
            "bbb.333",
            "ccc.444"
             ]
    }
  • Creating an image with parameter tags using a file in an OBS bucket (file address in the bucket: ims-image:centos70.qcow2)
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    POST https://{Endpoint}/v2/cloudimages/action
    {
          "name": "ims_test_file",
      "description": "Create an image from a file in an OBS bucket",
          "image_url": "ims-image:centos70.qcow2",
          "os_version": "CentOS 7.0 64bit",
          "min_disk": 40,
          "tags": [  
                "aaa.111",  
                "bbb.333",  
                "ccc.444"  
          ]     
    }
    
  • Creating a system disk image with parameter image_tags using an ECS (ID: 877a2cda-ba63-4e1e-b95f-e67e48b6129a)
    POST https://{Endpoint}/v2/cloudimages/action
    {
        "name": "ims_test",
        "description": "Create a system disk image from an ECS",
        "instance_id": "877a2cda-ba63-4e1e-b95f-e67e48b6129a",
        "image_tags": [
    {
                "key": "key2",
                "value": "value2"
            },
    {
                "key": "key1",
                "value": "value1"
    }
             ]
    }
  • Creating an image with parameter image_tags using a file in an OBS bucket (file address in the bucket: ims-image:centos70.qcow2)
    1
    2
    3
    4
    5
    6
    7
    8
    9
    POST https://{Endpoint}/v2/cloudimages/action
    {
           "name": "ims_test_file",
           "description": "Create an image from a file in an OBS bucket",
           "image_url": "ims-image:centos70.qcow2",
           "os_version": "CentOS 7.0 64bit",
           "min_disk": 40,
           "image_tags": [{"key":"key2","value":"value2"},{"key":"key1","value":"value1"}]    
    }
    

Response

  • Response parameters

    Parameter

    Type

    Description

    job_id

    String

    Specifies the asynchronous job ID.

    For details, see Querying the Status of an Asynchronous Job.

  • Example response
    STATUS CODE 200
    1
    2
    3
    {
        "job_id": "8a12fc664fb4daa3014fb4e581380005"
    }
    

Returned Values

  • Normal

    200

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    Request error. For details about the returned error code, see Error Codes.

    401 Unauthorized

    Authentication failed.

    403 Forbidden

    You do not have the rights to perform the operation.

    404 Not Found

    The requested resource was not found.

    500 Internal Server Error

    Internal service error.

    503 Service Unavailable

    The service is unavailable.

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback