Reads:3404Replies:2
AssociateEipAddress API issue
Hi,
Am trying to associate/bind EIP to the instance through API. I am working with python. This is my API script - #!/usr/bin/env python #coding=utf-8 from aliyunsdkcore.client import AcsClient from aliyunsdkcore.acs_exception.exceptions import ClientException from aliyunsdkcore.acs_exception.exceptions import ServerException from aliyunsdkvpc.request.v20160428.AssociateEipAddressRequest import AssociateEipAddressRequest client = AcsClient('<accessKeyId>', '<accessSecret>', 'ap-south-1') request = AssociateEipAddressRequest() request.set_accept_format('json') request.set_InstanceId("i-a2dee8g94lua97kxgvsx") request.set_AllocationId("eip-a2dhtaczichdrdgzeufo9") request.set_InstanceType("EcsInstance") request.set_PrivateIpAddress("149.129.132.6") request.set_Mode("NAT") response = client.do_action_with_exception(request) # python2: print(response) print(str(response, encoding='utf-8')) Here is the error response - { "RequestId": "B8AF03ED-0C1D-4E65-BF8D-0439B703DA3C", "HostId": "vpc.ap-south-1.aliyuncs.com", "Code": "InvalidNicOrVm.NotFound", "Message": "Bind nic or vm not exist." } |
|
1st Reply#
Posted time:Jan 20, 2020 23:39 PM
Hi,
Make sure that the associated instance must be in the same region as the Elastic IP address. |
|
|
2nd Reply#
Posted time:Jan 21, 2020 14:41 PM
|
|