Search in sources :

Example 16 with StartInstancesRequest

use of com.amazonaws.services.ec2.model.StartInstancesRequest in project openvidu-loadtest by OpenVidu.

the class Ec2Client method startInstances.

public void startInstances(List<String> instanceIds) {
    if (instanceIds.size() > 0) {
        StartInstancesRequest request = new StartInstancesRequest().withInstanceIds(instanceIds);
        ec2.startInstances(request);
        log.info("Instance {} is being starting", instanceIds);
        // Avoided start test before start instances
        sleep(WAIT_RUNNING_STATE_MS);
    }
}
Also used : StartInstancesRequest(com.amazonaws.services.ec2.model.StartInstancesRequest)

Example 17 with StartInstancesRequest

use of com.amazonaws.services.ec2.model.StartInstancesRequest in project prompto-platform by prompto.

the class EC2 method startInstance.

public void startInstance(String instanceId) {
    StartInstancesRequest startRequest = StartInstancesRequest.builder().instanceIds(instanceId).build();
    ec2.startInstances(startRequest);
}
Also used : StartInstancesRequest(software.amazon.awssdk.services.ec2.model.StartInstancesRequest)

Example 18 with StartInstancesRequest

use of com.amazonaws.services.ec2.model.StartInstancesRequest in project aws-sdk-android by aws-amplify.

the class StartInstancesRequest method getDryRunRequest.

/**
 * This method is intended for internal use only.
 * Returns the marshaled request configured with additional parameters to
 * enable operation dry-run.
 */
@Override
public Request<StartInstancesRequest> getDryRunRequest() {
    Request<StartInstancesRequest> request = new StartInstancesRequestMarshaller().marshall(this);
    request.addParameter("DryRun", Boolean.toString(true));
    return request;
}
Also used : StartInstancesRequestMarshaller(com.amazonaws.services.ec2.model.transform.StartInstancesRequestMarshaller)

Example 19 with StartInstancesRequest

use of com.amazonaws.services.ec2.model.StartInstancesRequest in project onebusaway-application-modules by camsys.

the class BundleServerServiceImpl method start.

@Override
public String start(String instanceId) {
    if (!_isAws) {
        return LOCAL_HOST;
    }
    if (LOCAL_HOST.equalsIgnoreCase(instanceId)) {
        return instanceId;
    }
    List<String> instances = new ArrayList<String>();
    instances.add(instanceId);
    StartInstancesRequest startInstancesRequest = new StartInstancesRequest(instances);
    StartInstancesResult startInstancesResult = _ec2.startInstances(startInstancesRequest);
    InstanceStateChange change = null;
    if (!startInstancesResult.getStartingInstances().isEmpty()) {
        change = startInstancesResult.getStartingInstances().get(0);
        _log.info("from state=" + change.getPreviousState() + " to state=" + change.getCurrentState());
        return change.getInstanceId();
    }
    return null;
}
Also used : StartInstancesResult(com.amazonaws.services.ec2.model.StartInstancesResult) StartInstancesRequest(com.amazonaws.services.ec2.model.StartInstancesRequest) ArrayList(java.util.ArrayList) InstanceStateChange(com.amazonaws.services.ec2.model.InstanceStateChange)

Aggregations

StartInstancesRequest (com.amazonaws.services.ec2.model.StartInstancesRequest)14 StartInstancesResult (com.amazonaws.services.ec2.model.StartInstancesResult)7 StopInstancesRequest (com.amazonaws.services.ec2.model.StopInstancesRequest)6 AmazonEC2 (com.amazonaws.services.ec2.AmazonEC2)4 StopInstancesResult (com.amazonaws.services.ec2.model.StopInstancesResult)4 ArrayList (java.util.ArrayList)4 AmazonEC2AsyncClient (com.amazonaws.services.ec2.AmazonEC2AsyncClient)3 DescribeInstancesRequest (com.amazonaws.services.ec2.model.DescribeInstancesRequest)3 InstanceStateChange (com.amazonaws.services.ec2.model.InstanceStateChange)3 AWSClientManager (com.vmware.photon.controller.model.adapters.awsadapter.util.AWSClientManager)3 AWSClientManagerFactory (com.vmware.photon.controller.model.adapters.awsadapter.util.AWSClientManagerFactory)3 BaseAdapterStage (com.vmware.photon.controller.model.adapters.util.BaseAdapterContext.BaseAdapterStage)3 DefaultAdapterContext (com.vmware.photon.controller.model.adapters.util.BaseAdapterContext.DefaultAdapterContext)3 ComputeState (com.vmware.photon.controller.model.resources.ComputeService.ComputeState)3 Operation (com.vmware.xenon.common.Operation)3 StatelessService (com.vmware.xenon.common.StatelessService)3 AmazonServiceException (com.amazonaws.AmazonServiceException)2 DescribeInstancesResult (com.amazonaws.services.ec2.model.DescribeInstancesResult)2 Instance (com.amazonaws.services.ec2.model.Instance)2 RunInstancesRequest (com.amazonaws.services.ec2.model.RunInstancesRequest)2