packer-cn/website/pages/docs/builders/alicloud-ecs.mdx

89 lines
2.8 KiB
Plaintext
Raw Normal View History

2020-03-18 18:46:47 -04:00
---
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:
2020-03-23 20:02:12 -04:00
@include 'builder/alicloud/ecs/RunConfig-required.mdx'
@include 'builder/alicloud/ecs/AlicloudImageConfig-required.mdx'
2020-03-18 18:46:47 -04:00
### Optional:
2020-03-23 20:02:12 -04:00
@include 'builder/alicloud/ecs/AlicloudAccessConfig-not-required.mdx'
@include 'builder/alicloud/ecs/AlicloudDiskDevice-not-required.mdx'
@include 'builder/alicloud/ecs/AlicloudDiskDevices-not-required.mdx'
@include 'builder/alicloud/ecs/RunConfig-not-required.mdx'
@include 'builder/alicloud/ecs/AlicloudImageConfig-not-required.mdx'
2020-03-18 18:46:47 -04:00
- `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",
"internet_charge_type": "PayByTraffic",
"image_force_delete": "true"
}
],
"provisioners": [
{
"type": "shell",
"inline": ["sleep 30", "yum install redis.x86_64 -y"]
}
]
}
```
2020-03-23 20:02:12 -04:00
~> Note: Images can become deprecated after a while; run
2020-03-18 18:46:47 -04:00
`aliyun ecs DescribeImages` to find one that exists.
2020-03-23 20:02:12 -04:00
~> Note: Since WinRM is closed by default in the system image. If you are
2020-03-18 18:46:47 -04:00
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.