github.com/ratanraj/packer@v1.3.2/website/source/docs/post-processors/alicloud-import.html.md (about)

     1  ---
     2  description: |
     3      The Packer Alicloud Import post-processor takes a RAW or VHD artifact from
     4      various builders and imports it to an Alicloud customized image list.
     5  layout: docs
     6  page_title: 'Alicloud Import Post-Processor'
     7  sidebar_current: 'docs-post-processors-alicloud-import'
     8  ---
     9  
    10  # Alicloud Import Post-Processor
    11  
    12  Type: `alicloud-import`
    13  
    14  The Packer Alicloud Import post-processor takes a RAW or VHD artifact from
    15  various builders and imports it to an Alicloud ECS Image.
    16  
    17  ## How Does it Work?
    18  
    19  The import process operates by making a temporary copy of the RAW or VHD to an OSS
    20  bucket, and calling an import task in ECS on the RAW or VHD file. Once
    21  completed, an Alicloud ECS Image is returned. The temporary RAW or VHD copy in
    22  OSS can be discarded after the import is complete.
    23  
    24  ## Configuration
    25  
    26  There are some configuration options available for the post-processor. There are
    27  two categories: required and optional parameters.
    28  
    29  ### Required:
    30  
    31  -   `access_key` (string) - This is the Alicloud access key. It must be provided,
    32      but it can also be sourced from the `ALICLOUD_ACCESS_KEY` environment
    33      variable.
    34  
    35  -   `secret_key` (string) - This is the Alicloud secret key. It must be provided,
    36      but it can also be sourced from the `ALICLOUD_SECRET_KEY` environment
    37      variable.
    38  
    39  -   `region` (string) - This is the Alicloud region. It must be provided, but it
    40      can also be sourced from the `ALICLOUD_REGION` environment variables.
    41  
    42  -   `image_name` (string) - The name of the user-defined image, \[2, 128\] English
    43      or Chinese characters. It must begin with an uppercase/lowercase letter or
    44      a Chinese character, and may contain numbers, `_` or `-`. It cannot begin
    45      with <http://> or <https://>.
    46  
    47  -   `oss_bucket_name` (string) - The name of the OSS bucket where the RAW or VHD
    48      file will be copied to for import. If the Bucket isn't exist, post-process
    49      will create it for you.
    50  
    51  -   `image_os_type` (string) - Type of the OS linux/windows
    52  
    53  -   `image_platform` (string) - platform such `CentOS`
    54  
    55  -   `image_architecture` (string) - Platform type of the image system:i386
    56      | x86\_64
    57  
    58  -   `format` (string) - The format of the image for import, now alicloud only
    59      support RAW and VHD.
    60  
    61  ### Optional:
    62  
    63  -   `oss_key_name` (string) - The name of the object key in `oss_bucket_name`
    64      where the RAW or VHD file will be copied to for import.
    65  
    66  -   `skip_clean` (boolean) - Whether we should skip removing the RAW or VHD file
    67      uploaded to OSS after the import process has completed. `true` means that we
    68      should leave it in the OSS bucket, `false` means to clean it out. Defaults to
    69      `false`.
    70  
    71  -   `image_description` (string) - The description of the image, with a length
    72      limit of 0 to 256 characters. Leaving it blank means null, which is the
    73      default value. It cannot begin with <http://> or <https://>.
    74  
    75  -   `image_force_delete` (boolean) - If this value is true, when the target image
    76      name is duplicated with an existing image, it will delete the existing image
    77      and then create the target image, otherwise, the creation will fail. The
    78      default value is false.
    79  
    80  -   `image_system_size` (number) - Size of the system disk, in GB, values range:
    81      -   cloud - 5 ~ 2000
    82      -   cloud\_efficiency - 20 ~ 2048
    83      -   cloud\_ssd - 20 ~ 2048
    84  
    85  ## Basic Example
    86  
    87  Here is a basic example. This assumes that the builder has produced a RAW
    88  artifact. The user must have the role `AliyunECSImageImportDefaultRole` with
    89  `AliyunECSImageImportRolePolicy`, post-process will automatically configure the
    90  role and policy for you if you have the privilege, otherwise, you have to ask
    91  the administrator configure for you in advance.
    92  
    93  ``` json
    94  "post-processors":[
    95      {
    96        "access_key":"{{user `access_key`}}",
    97        "secret_key":"{{user `secret_key`}}",
    98        "type":"alicloud-import",
    99        "oss_bucket_name": "packer",
   100        "image_name": "packer_import",
   101        "image_os_type": "linux",
   102        "image_platform": "CentOS",
   103        "image_architecture": "x86_64",
   104        "image_system_size": "40",
   105        "region":"cn-beijing"
   106      }
   107    ]
   108  ```
   109  
   110  This will take the RAW generated by a builder and upload it to OSS. In this
   111  case, an existing bucket called `packer` in the `cn-beijing` region will be
   112  where the copy is placed.
   113  
   114  Once uploaded, the import process will start, creating an Alicloud ECS image in
   115  the `cn-beijing` region with the name you specified in template file.