alibaba / packer-provider

Apache License 2.0
93 stars 26 forks source link

Error allocation EIP #28

Closed mosuke5 closed 7 years ago

mosuke5 commented 7 years ago

hi I'm mosuke5. I tried to use packer-provider. but following error happened. When allocationg eip to ecs instance, error happened. Do you know this reason?

Alicloud-ecs output will be in this color.

==> alicloud-ecs: Force delete flag found, skipping prevalidating image name.
    alicloud-ecs: Found image ID: centos_7_2_64_40G_base_20170222.vhd
==> alicloud-ecs: Creating temporary keypair: packer_5981613f-b3e4-c283-d3d8-73906ca10090
==> alicloud-ecs: Creating vpc
==> alicloud-ecs: Creating vswitch...
==> alicloud-ecs: Creating security groups...
==> alicloud-ecs: Creating instance.
==> alicloud-ecs: Allocating eip
==> alicloud-ecs: Error allocating eip: Aliyun API Error: RequestId: E2DA928E-9E73-4790-962B-BC6B41BC475E Status Code: 400 Code: UnknownError Message: The request processing has failed due to some unknown error.
==> alicloud-ecs: Deleting instance because of cancellation or error...

I used this template json.

{
  "variables": {
    "access_key": "xxxxxxxxxxxx",
    "secret_key": "xxxxxxxxxxxxx"
  },
  "builders": [{
    "type":"alicloud-ecs",
    "access_key":"{{user `access_key`}}",
    "secret_key":"{{user `secret_key`}}",
    "region":"ap-southeast-1",
    "image_name":"packer_test2",
    "source_image":"centos_7_2_64_40G_base_20170222.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"
    ]
  }]
}
cosmos-sun commented 7 years ago

Are you using the latest release? https://github.com/alibaba/packer-provider/releases

mosuke5 commented 7 years ago

yes. I'm using packer version v1.0.3 and alibaba provider v1.1.2. and I move provider packages into same directory as packer.

% ll /usr/local/bin | grep packer
-rwxr-xr-x@ 1 shinyamori  staff   54447660  7 17 16:54 packer
-rwxr-xr-x@ 1 shinyamori  staff   18641340  7 20 11:45 packer-builder-alicloud-ecs
-rwxr-xr-x@ 1 shinyamori  staff   18641340  7 20 11:45 packer-post-processor-alicloud-import
cosmos-sun commented 7 years ago

please check this commit: https://github.com/alibaba/packer-provider/commit/e0b00fc8f43015d62b787a93044d7df6537b7dd8 @zhuzhih2017 has fixed this kind of problem in release v1.1.2 and I just built my image without any problem yesterday.

zhuzhih2017 commented 7 years ago

@mosuke5 I can create the image successful in my local environment with your script and I check the error message your pasted and some internal constrain violation in your request and I'm checking the root cause.

zhuzhih2017 commented 7 years ago

@mosuke5, currently, ECS is only support charge type PayByTraffic for the site outer of China, but the default value is "PayByBandwidth", you can add following line in the template script.

"internet_charge_type":"PayByTraffic",

I'll update the sample and add above line to avoid fail for the user.

zhuzhih2017 commented 7 years ago

@mosuke5 You can add "internet_charge_type":"PayByTraffic", and try again. If still have problem, you can reopen this issue. Thanks.

mosuke5 commented 7 years ago

Thank you very much. I confirmed it works well.

mosuke5 commented 7 years ago

and this announcement is good! https://www.alibabacloud.com/notice/Alibaba-Cloud-Supports-Packer-and-Terraform