Scalr\Service\Aws\Ec2\V20150415\Ec2Api::runInstances PHP 메소드

runInstances() 공개 메소드

Launches the specified number of instances of an AMI for which you have permissions. If Amazon EC2 cannot launch the minimum number of instances you request, no instances will be launched. If there is insufficient capacity to launch the maximum number of instances you request, Amazon EC2 launches the minimum number specified and allocates the remaining available instances using round robin. Note! Every instance is launched in a security group (created using the CreateSecurityGroup operation). If you don't specify a security group in the RunInstances request, the "default" security group is used.
public runInstances ( Scalr\Service\Aws\Ec2\DataType\RunInstancesRequestData $request ) : Scalr\Service\Aws\Ec2\DataType\ReservationData
$request Scalr\Service\Aws\Ec2\DataType\RunInstancesRequestData Request data
리턴 Scalr\Service\Aws\Ec2\DataType\ReservationData Returns the ReservationData object
    public function runInstances(RunInstancesRequestData $request)
    {
        $result = null;
        $options = $request->getQueryArrayBare();
        $response = $this->client->call(ucfirst(__FUNCTION__), $options);
        if ($response->getError() === false) {
            //Success
            $sxml = simplexml_load_string($response->getRawContent());
            $result = new ReservationData();
            $result->setEc2($this->ec2);
            $result->reservationId = (string) $sxml->reservationId;
            $result->ownerId = (string) $sxml->ownerId;
            $result->requesterId = $this->exist($sxml->requesterId) ? (string) $sxml->requesterId : null;
            $result->setGroupSet($this->_loadGroupList($sxml->groupSet));
            $result->setInstancesSet($this->_loadInstanceList($sxml->instancesSet));
        }
        return $result;
    }
Ec2Api