packer-cn/website/content/docs/post-processors/ucloud-import.mdx

59 lines
2.3 KiB
Plaintext

---
description: >
The Packer UCloud Import post-processor takes the RAW, VHD, VMDK, or qcow2
artifact from various builders and imports it to UCloud customized image list
for UHost Instance.
page_title: UCloud Import Post-Processors
sidebar_title: UCloud Import
---
# UCloud Import Post-Processor
Type: `ucloud-import`
The Packer UCloud Import post-processor takes the RAW, VHD, VMDK, or qcow2 artifact from various builders and imports it to UCloud customized image list for UHost Instance.
~> **Note** Some regions don't support image import. You may refer to [ucloud console](https://console.ucloud.cn/uhost/uimage) for more detail. If you want to import to unsupported regions, please import the image in `cn-bj2` first, and then copy the image to the target region.
## How Does it Work?
The import process operates by making a temporary copy of the RAW, VHD, VMDK, or qcow2 to an UFile bucket, and calling an import task in UHost on the RAW, VHD, VMDK, or qcow2 file. Once completed, an UCloud UHost Image is returned. The temporary RAW, VHD, VMDK, or qcow2 copy in UFile can be discarded after the import is complete.
## Configuration
There are some configuration options available for the post-processor. There
are two categories: required and optional parameters.
### Required:
@include 'builder/ucloud/common/AccessConfig-required.mdx'
@include 'post-processor/ucloud-import/Config-required.mdx'
### Optional:
@include 'builder/ucloud/common/AccessConfig-not-required.mdx'
@include 'post-processor/ucloud-import/Config-not-required.mdx'
## Basic Example
Here is a basic example. This assumes that the builder has produced a RAW artifact for us to work with. This will take the RAW image generated by a builder and upload it to UFile. Once uploaded, the import process will start, creating an UCloud UHost image to the region `cn-bj2`.
```json
"post-processors":[
{
"type":"ucloud-import",
"public_key": "{{user `ucloud_public_key`}}",
"private_key": "{{user `ucloud_private_key`}}",
"project_id": "{{user `ucloud_project_id`}}",
"region":"cn-bj2",
"ufile_bucket_name": "packer-import",
"image_name": "packer_import",
"image_os_type": "CentOS",
"image_os_name": "CentOS 6.10 64位",
"format": "raw"
}
]
```