packer-cn/website/pages/docs/post-processors/alicloud-import.mdx

75 lines
2.4 KiB
Plaintext
Raw Normal View History

2020-03-18 18:46:47 -04:00
---
description: |
The Packer Alicloud Import post-processor takes a RAW or VHD artifact from
various builders and imports it to an Alicloud customized image list.
layout: docs
page_title: Alicloud Import Post-Processor
sidebar_title: Alicloud Import
2020-03-18 18:46:47 -04:00
---
# Alicloud Import Post-Processor
Type: `alicloud-import`
The Packer Alicloud Import post-processor takes a RAW or VHD artifact from
various builders and imports it to an Alicloud ECS Image.
## How Does it Work?
The import process operates by making a temporary copy of the RAW or VHD to an
OSS bucket, and calling an import task in ECS on the RAW or VHD file. Once
completed, an Alicloud ECS Image is returned. The temporary RAW or VHD copy in
OSS 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/alicloud/ecs/AlicloudAccessConfig-required.mdx'
2020-03-18 18:46:47 -04:00
@include 'builder/alicloud/ecs/AlicloudImageConfig-required.mdx'
2020-03-18 18:46:47 -04:00
@include 'post-processor/alicloud-import/Config-required.mdx'
2020-03-18 18:46:47 -04:00
### Optional:
- `keep_input_artifact` (boolean) - if true, do not delete the RAW or VHD
disk image after importing it to the cloud. Defaults to false.
@include 'post-processor/alicloud-import/Config-not-required.mdx'
2020-03-18 18:46:47 -04:00
## Basic Example
Here is a basic example. This assumes that the builder has produced a RAW
artifact. The user must have the role `AliyunECSImageImportDefaultRole` with
`AliyunECSImageImportRolePolicy`, post-process will automatically configure the
role and policy for you if you have the privilege, otherwise, you have to ask
the administrator configure for you in advance.
```json
"post-processors":[
{
"access_key":"{{user `access_key`}}",
"secret_key":"{{user `secret_key`}}",
"type":"alicloud-import",
"oss_bucket_name": "packer",
"image_name": "packer_import",
"image_os_type": "linux",
"image_platform": "CentOS",
"image_architecture": "x86_64",
"image_system_size": "40",
"region":"cn-beijing"
}
]
```
This will take the RAW generated by a builder and upload it to OSS. In this
case, an existing bucket called `packer` in the `cn-beijing` region will be
where the copy is placed.
Once uploaded, the import process will start, creating an Alicloud ECS image in
the `cn-beijing` region with the name you specified in template file.