AWS SDK for PHP如何获取保留实例列表?

时间:2016-08-17 10:34:57

标签: amazon-web-services amazon-ec2 aws-php-sdk

我可以成功获取EC2实例列表。

使用以下代码

$conf_aws = array();
$conf_aws['credentials']= array(
    'key' => $config['AWS']['configkey'],
    'secret'  => $config['AWS']['configsecret'],
);

$conf_aws['region'] = 'ap-southeast-1';
$conf_aws['version']='latest';
$ec2Client  = \Aws\Ec2\Ec2Client::factory($conf_aws);
$list = $ec2Client->DescribeInstances();

任何人都可以建议如何获取保留实例的列表。

1 个答案:

答案 0 :(得分:1)

使用此编辑后的代码即可使用。

$conf_aws = array();
$conf_aws['credentials']= array(
    'key' => $config['AWS']['configkey'],
    'secret'  => $config['AWS']['configsecret'],
);

$conf_aws['region'] = 'ap-southeast-1';
$conf_aws['version']='latest';
$ec2Client  = \Aws\Ec2\Ec2Client::factory($conf_aws);
$list = $ec2->describe_reserved_instances_listing();