0

I am using python SDK for using Alibaba ECS . I couldn't create elastic ip (EIP) using it. I've used the following code.

from aliyunsdkcore.client import AcsClient
from aliyunsdkecs.request.v20140526 import AllocateEipAddressRequest

AccessKeyId = '*****************'
AccessKeySecret = '*******************'
DefaultRegion = 'us-east-1'

client = AcsClient(AccessKeyId, AccessKeySecret, DefaultRegion)
request_eip = AllocateEipAddressRequest.AllocateEipAddressRequest()
response = client.do_action_with_exception(request_eip)

It throws the following error.

aliyunsdkcore.acs_exception.exceptions.ServerException: HTTP Status: 500 Error:InternalError The request processing has failed due to some unknown error, exception or failure. RequestID: XXXXXXXXXXXXXXXXXXXXXXXXXXX

What am I missing here? Please, help!

Suraj Shrestha
  • 728
  • 11
  • 19

1 Answers1

0

Here's the response from Alibaba Official support team, which solved my issue.

Dear Customer

We are sorry to inform you that this case is related to a known issue in ECS API. Our backend team will resolve this in the next version of the ECS, VPC API.

Meanwhile please add the optional parameter "InternetChargeType": "PayByBandwidth"in your request as a work around.

#Example Code:

def main():
    client = AcsClient(
        "LTxxxxxxxxxxxxH",
        "RxxxxxxxxxxxxxxT",
        "ur region")
    request_eip = AllocateEipAddressRequest.AllocateEipAddressRequest()
    request_eip.set_InternetChargeType('PayByTraffic')
    response = client.do_action_with_exception(request_eip)
    print(response)

Thank you

Suraj Shrestha
  • 728
  • 11
  • 19