1

我可以成功获取 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();

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

4

1 回答 1

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();
于 2016-08-29T10:34:47.980 回答