Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 如何使用Boto获得亚马逊的价格?_Amazon Web Services_Tornado_Boto - Fatal编程技术网

Amazon web services 如何使用Boto获得亚马逊的价格?

Amazon web services 如何使用Boto获得亚马逊的价格?,amazon-web-services,tornado,boto,Amazon Web Services,Tornado,Boto,这似乎是最重要的,我的问题如下: 它是否提供分页功能(只要求10种产品,因为amazon每页提供10种产品,那么我只想获得第一页…),然后如何(示例代码?) 然后如何解析产品解析,我已经使用了,但遗憾的是它不提供分页,所以所有的提供都在不断迭代 通常,分页由请求api的客户端执行。要在boto中执行此操作,您需要切断系统。例如,假设您使用get_all_instances def通过boto向AWS打电话;您需要以某种方式存储这些信息,然后跟踪显示了哪些服务器,哪些没有。据我所知,boto没有

这似乎是最重要的,我的问题如下:

  • 它是否提供分页功能(只要求10种产品,因为amazon每页提供10种产品,那么我只想获得第一页…),然后如何(示例代码?)
  • 然后如何解析产品解析,我已经使用了,但遗憾的是它不提供分页,所以所有的提供都在不断迭代

通常,分页由请求api的客户端执行。要在boto中执行此操作,您需要切断系统。例如,假设您使用get_all_instances def通过boto向AWS打电话;您需要以某种方式存储这些信息,然后跟踪显示了哪些服务器,哪些没有。据我所知,boto没有大多数开发人员习惯于从MySQL获取的限制功能。就我个人而言,我扫描了我的所有实例,并将它们保存在mongo中,如下所示:

for r in conn.get_all_instances():        # loop through all reservations
   groups = [g.name for g in r.groups]    # get a list of groups for this reservation
   for x in r.instances:                  # loop through all instances with-in reservation
      groups = ','.join(groups)         # join the groups into a comma separated list 
      name = x.tags.get('Name','');       # get instance name from the 'Name' tag

      new_record = { "tagname":name, "ip_address":x.private_ip_address, 
                      "external_ip_nat":x.ip_address, "type":x.instance_type,
                      "state":x.state, "base_image":x.image_id, "placement":x.placement, 
                      "public_ec2_dns":x.public_dns_name,
                      "launch_time":x.launch_time, "parent": ObjectId(account['_id'])}
      new_record['groups'] = groups
      systems_coll.update({'_id':x.id},{"$set":new_record},upsert=True)
      error = db.error()
      if error != None:
           print "err:%s:" % str(error)
您还可以将它们包装在try/catch块中。由你决定。一旦你把他们从boto中解救出来,做切割工作应该是微不足道的


--Jess

通常,分页由请求api的客户端执行。要在boto中执行此操作,您需要切断系统。例如,假设您使用get_all_instances def通过boto向AWS打电话;您需要以某种方式存储这些信息,然后跟踪显示了哪些服务器,哪些没有。据我所知,boto没有大多数开发人员习惯于从MySQL获取的限制功能。就我个人而言,我扫描了我的所有实例,并将它们保存在mongo中,如下所示:

for r in conn.get_all_instances():        # loop through all reservations
   groups = [g.name for g in r.groups]    # get a list of groups for this reservation
   for x in r.instances:                  # loop through all instances with-in reservation
      groups = ','.join(groups)         # join the groups into a comma separated list 
      name = x.tags.get('Name','');       # get instance name from the 'Name' tag

      new_record = { "tagname":name, "ip_address":x.private_ip_address, 
                      "external_ip_nat":x.ip_address, "type":x.instance_type,
                      "state":x.state, "base_image":x.image_id, "placement":x.placement, 
                      "public_ec2_dns":x.public_dns_name,
                      "launch_time":x.launch_time, "parent": ObjectId(account['_id'])}
      new_record['groups'] = groups
      systems_coll.update({'_id':x.id},{"$set":new_record},upsert=True)
      error = db.error()
      if error != None:
           print "err:%s:" % str(error)
您还可以将它们包装在try/catch块中。由你决定。一旦你把他们从boto中解救出来,做切割工作应该是微不足道的

--杰斯