packer-cn/website/source/docs/builders/alicloud-ecs.html.md.erb

89 lines
2.9 KiB
Plaintext

---
description: |
The `alicloud-ecs` Packer builder plugin provide the capability to build
customized images based on an existing base images.
layout: docs
page_title: Alicloud Image Builder
sidebar_current: 'docs-builders-alicloud-ecs'
---
# Alicloud Image Builder
Type: `alicloud-ecs`
The `alicloud-ecs` Packer builder plugin provide the capability to build
customized images based on an existing base images.
## Configuration Reference
The following configuration options are available for building Alicloud images.
In addition to the options listed here, a
[communicator](../templates/communicator.html) can be configured for this
builder.
### Required:
<%= partial "partials/builder/alicloud/ecs/AlicloudAccessConfig-required" %>
<%= partial "partials/builder/alicloud/ecs/RunConfig-required" %>
<%= partial "partials/builder/alicloud/ecs/AlicloudImageConfig-required" %>
### Optional:
<%= partial "partials/builder/alicloud/ecs/AlicloudAccessConfig-not-required" %>
<%= partial "partials/builder/alicloud/ecs/AlicloudDiskDevice-not-required" %>
<%= partial "partials/builder/alicloud/ecs/AlicloudDiskDevices-not-required" %>
<%= partial "partials/builder/alicloud/ecs/RunConfig-not-required" %>
<%= partial "partials/builder/alicloud/ecs/AlicloudImageConfig-not-required" %>
- `temporary_key_pair_name` (string) - The name of the temporary key pair to
generate. By default, Packer generates a name that looks like
`packer_<UUID>`, where &lt;UUID&gt; is a 36 character unique identifier.
## Basic Example
Here is a basic example for Alicloud.
``` json
{
"variables": {
"access_key": "{{env `ALICLOUD_ACCESS_KEY`}}",
"secret_key": "{{env `ALICLOUD_SECRET_KEY`}}"
},
"builders": [{
"type":"alicloud-ecs",
"access_key":"{{user `access_key`}}",
"secret_key":"{{user `secret_key`}}",
"region":"cn-beijing",
"image_name":"packer_test2",
"source_image":"centos_7_04_64_20G_alibase_201701015.vhd",
"ssh_username":"root",
"instance_type":"ecs.n1.tiny",
"io_optimized":"true",
"image_force_delete":"true"
}],
"provisioners": [{
"type": "shell",
"inline": [
"sleep 30",
"yum install redis.x86_64 -y"
]
}]
}
```
\~&gt; Note: Images can become deprecated after a while; run
`aliyun ecs DescribeImages` to find one that exists.
\~&gt; Note: Since WinRM is closed by default in the system image. If you are
planning to use Windows as the base image, you need enable it by userdata in
order to connect to the instance, check
[alicloud\_windows.json](https://github.com/hashicorp/packer/tree/master/examples/alicloud/basic/alicloud_windows.json)
and
[winrm\_enable\_userdata.ps1](https://github.com/hashicorp/packer/tree/master/examples/alicloud/basic/winrm_enable_userdata.ps1)
for details.
See the
[examples/alicloud](https://github.com/hashicorp/packer/tree/master/examples/alicloud)
folder in the packer project for more examples.