Gets the list of the EC2 instances
for the specified environment and AWS location
public GetServersList ( Scalr_Environment $environment, string $region, boolean $skipCache = false ) : array | ||
$environment | Scalr_Environment | Environment Object |
$region | string | EC2 location name |
$skipCache | boolean | optional Whether it should skip the cache. |
return | array | Returns array looks like array(InstanceId => stateName) |
/** * @test */ public function testGetServersList() { $env = $this->getEnvironment(); $servers = $this->module->GetServersList($env, self::REGION, true); $this->assertInternalType('array', $servers); $ref = new ReflectionClass('Scalr\\Service\\Aws\\Ec2\\DataType\\InstanceStateData'); if (count($servers)) { foreach ($servers as $instanceid => $v) { $this->assertStringStartsWith('i-', $instanceid); $this->assertNotEmpty($v); } } }