github.com/mmcquillan/packer@v1.1.1-0.20171009221028-c85cf0483a5d/website/source/docs/builders/alicloud-ecs.html.md (about)

     1  ---
     2  description: |
     3      The `alicloud-ecs` Packer builder plugin provide the capability to build
     4      customized images based on an existing base images.
     5  layout: docs
     6  page_title: Alicloud Image Builder
     7  sidebar_current: 'docs-builders-alicloud-ecs'
     8  ---
     9  
    10  # Alicloud Image Builder
    11  
    12  Type: `alicloud-ecs`
    13  
    14  The `alicloud-ecs` Packer builder plugin provide the capability to build
    15  customized images based on an existing base images.
    16  
    17  ## Configuration Reference
    18  
    19  The following configuration options are available for building Alicloud images.
    20  In addition to the options listed here,
    21  a [communicator](/docs/templates/communicator.html) can be configured for this
    22  builder.
    23  
    24  ### Required:
    25  
    26  -   `access_key` (string) - This is the Alicloud access key. It must be provided,
    27      but it can also be sourced from the `ALICLOUD_ACCESS_KEY` environment
    28      variable.
    29  
    30  -   `secret_key` (string) - This is the Alicloud secret key. It must be provided,
    31      but it can also be sourced from the `ALICLOUD_SECRET_KEY` environment
    32      variable.
    33  
    34  -   `region` (string) - This is the Alicloud region. It must be provided, but it
    35      can also be sourced from the `ALICLOUD_REGION` environment variables.
    36  
    37  -   `instance_type` (string) - Type of the instance. For values, see [Instance
    38      Type Table](). You can also obtain the latest instance type table by invoking
    39      the [Querying Instance Type
    40      Table](https://intl.aliyun.com/help/doc-detail/25620.htm?spm=a3c0i.o25499en.a3.6.Dr1bik)
    41      interface.
    42  
    43  -   `image_name` (string) - The name of the user-defined image, \[2, 128\] English
    44      or Chinese characters. It must begin with an uppercase/lowercase letter or
    45      a Chinese character, and may contain numbers, `_` or `-`. It cannot begin with
    46      `http://` or `https://`.
    47  
    48  -   `source_image` (string) - This is the base image id which you want to create
    49      your customized images.
    50  
    51  ### Optional:
    52  
    53  -   `skip_region_validation` (bool) - The region validation can be skipped if this
    54      value is true, the default value is false.
    55  
    56  -   `image_description` (string) - The description of the image, with a length
    57      limit of 0 to 256 characters. Leaving it blank means null, which is the
    58      default value. It cannot begin with `http://` or `https://`.
    59  
    60  -   `image_version` (string) - The version number of the image, with a length limit
    61      of 1 to 40 English characters.
    62  
    63  -   `image_share_account` (array of string) - The IDs of to-be-added Aliyun
    64      accounts to which the image is shared. The number of accounts is 1 to 10. If
    65      number of accounts is greater than 10, this parameter is ignored.
    66  
    67  -   `image_copy_regions` (array of string) - Copy to the destination regionIds.
    68  
    69  -   `image_copy_names` (array of string) - The name of the destination image, \[2,
    70      128\] English or Chinese characters. It must begin with an uppercase/lowercase
    71      letter or a Chinese character, and may contain numbers, `_` or `-`. It cannot
    72      begin with `http://` or `https://`.
    73  
    74  -   `image_force_delete` (bool) - If this value is true, when the target image name
    75      is duplicated with an existing image, it will delete the existing image and
    76      then create the target image, otherwise, the creation will fail. The default
    77      value is false.
    78  
    79  -   `image_force_delete_snapshots` (bool) - If this value is true, when delete the
    80      duplicated existing image, the source snapshot of this image will be delete
    81      either.
    82  
    83  -   `disk_name` (string) - The value of disk name is blank by default. \[2, 128\]
    84      English or Chinese characters, must begin with an uppercase/lowercase letter
    85      or Chinese character. Can contain numbers, `.`, `_` and `-`. The disk name
    86      will appear on the console. It cannot begin with `http://` or `https://`.
    87  
    88  -   `disk_category` (string) - Category of the data disk. Optional values are:
    89      -   cloud - general cloud disk
    90      -   cloud\_efficiency - efficiency cloud disk
    91      -   cloud\_ssd - cloud SSD
    92  
    93      Default value: cloud.
    94  
    95  -   `disk_size` (int) - Size of the system disk, in GB, values range:
    96      -   cloud - 5 ~ 2000
    97      -   cloud\_efficiency - 20 ~ 2048
    98      -   cloud\_ssd - 20 ~ 2048
    99  
   100      The value should be equal to or greater than the size of the specific SnapshotId.
   101  
   102  -   `disk_snapshot_id` (string) - Snapshots are used to create the data disk
   103      After this parameter is specified, Size is ignored. The actual size of the
   104      created disk is the size of the specified snapshot.
   105  
   106      Snapshots from on or before July 15, 2013 cannot be used to create a disk.
   107  
   108  -   `disk_description` (string) - The value of disk description is blank by default. \[2, 256\] characters. The disk description will appear on the console. It cannot begin with `http://` or `https://`.
   109  
   110  -   `disk_delete_with_instance` (string) - Whether or not the disk is released along with the instance:
   111  -   True indicates that when the instance is released, this disk will be released with it
   112  -   False indicates that when the instance is released, this disk will be retained.
   113  
   114  -   `disk_device` (string) - Device information of the related instance: such as
   115      `/dev/xvdb` It is null unless the Status is In\_use.
   116  
   117  -   `zone_id` (string) - ID of the zone to which the disk belongs.
   118  
   119  -   `io_optimized` (bool) - I/O optimized.
   120  
   121      Default value: false for Generation I instances; true for other instances.
   122  
   123  -   `force_stop_instance` (bool) - Whether to force shutdown upon device restart.
   124      The default value is `false`.
   125  
   126      If it is set to `false`, the system is shut down normally; if it is set to
   127      `true`, the system is forced to shut down.
   128  
   129  -   `security_group_id` (string) - ID of the security group to which a newly
   130      created instance belongs. Mutual access is allowed between instances in one
   131      security group. If not specified, the newly created instance will be added to
   132      the default security group. If the default group doesn’t exist, or the number
   133      of instances in it has reached the maximum limit, a new security group will
   134      be created automatically.
   135  
   136  -   `security_group_name` (string) - The security group name. The default value is
   137      blank. \[2, 128\] English or Chinese characters, must begin with an
   138      uppercase/lowercase letter or Chinese character. Can contain numbers, `.`,
   139      `_` or `-`. It cannot begin with `http://` or `https://`.
   140  
   141  -   `user_data` (string) - The UserData of an instance must be encoded in `Base64`
   142      format, and the maximum size of the raw data is `16 KB`.
   143  
   144  -   `user_data_file` (string) - The file name of the userdata.
   145  
   146  -   `vpc_id` (string) - VPC ID allocated by the system.
   147  
   148  -   `vpc_name` (string) - The VPC name. The default value is blank. \[2, 128\]
   149      English or Chinese characters, must begin with an uppercase/lowercase letter
   150      or Chinese character. Can contain numbers, `_` and `-`. The disk description
   151      will appear on the console. Cannot begin with `http://` or `https://`.
   152  
   153  -   `vpc_cidr_block` (string) - Value options: `192.168.0.0/16` and `172.16.0.0/16`.
   154      When not specified, the default value is `172.16.0.0/16`.
   155  
   156  -   `vswitch_id` (string) - The ID of the VSwitch to be used.
   157  
   158  -   `instance_name` (string) - Display name of the instance, which is a string of
   159      2 to 128 Chinese or English characters. It must begin with an
   160      uppercase/lowercase letter or a Chinese character and can contain numerals,
   161      `.`, `_`, or `-`. The instance name is displayed on the Alibaba Cloud
   162      console. If this parameter is not specified, the default value is InstanceId
   163      of the instance. It cannot begin with `http://` or `https://`.
   164  
   165  -   `internet_charge_type` (string) - Internet charge type, which can be
   166      `PayByTraffic` or `PayByBandwidth`. Optional values:
   167      -   PayByBandwidth
   168      -   PayByTraffic
   169  
   170      If this parameter is not specified, the default value is `PayByBandwidth`.
   171      For the regions out of China, currently only support `PayByTraffic`, you must
   172      set it manfully.
   173  
   174  
   175  -   `internet_max_bandwidth_out` (string) - Maximum outgoing bandwidth to the public
   176      network, measured in Mbps (Mega bit per second).
   177  
   178      Value range:
   179      -   PayByBandwidth: \[0, 100\]. If this parameter is not specified, API automatically sets it to 0 Mbps.
   180      -   PayByTraffic: \[1, 100\]. If this parameter is not specified, an error is returned.
   181  
   182  -   `temporary_key_pair_name` (string) - The name of the temporary key pair to
   183      generate. By default, Packer generates a name that looks like `packer_<UUID>`,
   184      where `<UUID>` is a 36 character unique identifier.
   185  
   186  ## Basic Example
   187  
   188  Here is a basic example for Alicloud.
   189  
   190  ``` json
   191  {
   192    "variables": {
   193      "access_key": "{{env `ALICLOUD_ACCESS_KEY`}}",
   194      "secret_key": "{{env `ALICLOUD_SECRET_KEY`}}"
   195    },
   196    "builders": [{
   197      "type":"alicloud-ecs",
   198      "access_key":"{{user `access_key`}}",
   199      "secret_key":"{{user `secret_key`}}",
   200      "region":"cn-beijing",
   201      "image_name":"packer_test2",
   202      "source_image":"centos_7_2_64_40G_base_20170222.vhd",
   203      "ssh_username":"root",
   204      "instance_type":"ecs.n1.tiny",
   205      "io_optimized":"true",
   206      "image_force_delete":"true"
   207    }],
   208    "provisioners": [{
   209      "type": "shell",
   210      "inline": [
   211        "sleep 30",
   212        "yum install redis.x86_64 -y"
   213      ]
   214    }]
   215  }
   216  ```
   217  
   218  See the
   219  [examples/alicloud](https://github.com/hashicorp/packer/tree/master/examples/alicloud)
   220  folder in the packer project for more examples.