该卷与实例不在同一可用区中

时间:2013-03-21 17:47:19

标签: python amazon-web-services amazon-ec2 volume boto

我试图在我的代码中发现错误,所以我创建了一个实例,而不是尝试将卷附加到此实例,但收到错误:The volume 'vol-fc61968f' is not in the same availability zone as instance,这清楚地表明区域不同 我尝试将可用区放入a_zone变量,但不幸的是,它不起作用,所以请告诉我我的问题是什么

>>> a_zone = instance.placement
>>> a_zone
us-east-1c
>>> ec2.create_volume(2,a_zone)
Volume:vol-7957a00a
>>> 
>>> volume.zone
us-east-1d

已更新

我这样做了:

>>> dir(instance)
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_in_monitoring_element', '_placement', '_previous_state', '_state', '_update', 'add_tag', 'ami_launch_index', 'architecture', 'block_device_mapping', 'client_token', 'confirm_product', 'connection', 'create_image', 'dns_name', 'ebs_optimized', 'endElement', 'eventsSet', 'get_attribute', 'get_console_output', 'group_name', 'groups', 'hypervisor', 'id', 'image_id', 'instance_profile', 'instance_type', 'interfaces', 'ip_address', 'item', 'kernel', 'key_name', 'launch_time', 'modify_attribute', 'monitor', 'monitored', 'monitoring', 'persistent', 'placement', 'placement_group', 'placement_tenancy', 'platform', 'previous_state', 'previous_state_code', 'private_dns_name', 'private_ip_address', 'product_codes', 'public_dns_name', 'ramdisk', 'reason', 'reboot', 'region', 'remove_tag', 'requester_id', 'reset_attribute', 'root_device_name', 'root_device_type', 'spot_instance_request_id', 'start', 'startElement', 'state', 'state_code', 'state_reason', 'stop', 'subnet_id', 'tags', 'terminate', 'unmonitor', 'update', 'use_ip', 'virtualization_type', 'vpc_id']
>>> instance.placement
us-east-1c
>>> instance.placement.zone
Traceback (most recent call last):
  File "/usr/lib/gedit/plugins/pythonconsole/console.py", line 383, in __run
    r = eval(command, self.namespace, self.namespace)
  File "<string>", line 1, in <module>
AttributeError: 'unicode' object has no attribute 'zone'
>>> 

0 个答案:

没有答案