AWS:检索链接到beanstalk环境的EC2实例ID

时间:2013-12-05 22:22:22

标签: amazon-web-services boto

如何将实例ID链接到EBS环境(例如使用boto):

(' EnvironmentId' param不是EC2 AMI ID)

def get_environment_instance(self, env_name):
        """
        Returns the environment instance id
        """
        response = self.ebs.describe_environments(application_name=self.app_name,environment_names=[env_name],include_deleted=False)
        envs = response['DescribeEnvironmentsResponse']['DescribeEnvironmentsResult']['Environments']
        for env in envs[:]:
                out('---'+  env['EnvironmentId'])
        return None

1 个答案:

答案 0 :(得分:0)

我认为您需要describe_environment_resources方法,而不是describe_environments。这应该返回环境使用的所有AWS资源,包括所有EC2实例的实例ID。