Search in sources :

Example 66 with Instance

use of software.amazon.awssdk.services.ec2.model.Instance in project GNS by MobilityFirst.

the class AWSEC2 method createAndInitInstance.

/**
   * Creates an EC2 instance in the region given. Timeout in milleseconds can be specified.
   *
   * @param ec2
   * @param region
   * @param amiRecord
   * @param instanceName
   * @param keyName
   * @param securityGroupName
   * @param script
   * @param tags
   * @param elasticIP
   * @param timeout
   * @return a new instance instance
   */
public static Instance createAndInitInstance(AmazonEC2 ec2, RegionRecord region, AMIRecord amiRecord, String instanceName, String keyName, String securityGroupName, String script, Map<String, String> tags, String elasticIP, int timeout) {
    try {
        // set the region (AKA endpoint)
        setRegion(ec2, region);
        // create the instance
        SecurityGroup securityGroup = findOrCreateSecurityGroup(ec2, securityGroupName);
        String keyPair = findOrCreateKeyPair(ec2, keyName);
        String instanceID = createInstanceAndWait(ec2, amiRecord, keyPair, securityGroup);
        if (instanceID == null) {
            return null;
        }
        System.out.println("Instance " + instanceName + " is running in " + region.name());
        // add a name to the instance
        addInstanceTag(ec2, instanceID, "Name", instanceName);
        if (tags != null) {
            addInstanceTags(ec2, instanceID, tags);
        }
        Instance instance = findInstance(ec2, instanceID);
        if (instance == null) {
            return null;
        }
        String hostname = instance.getPublicDnsName();
        System.out.println("Waiting " + timeout / 1000 + " seconds for " + instanceName + " (" + hostname + ", " + instanceID + ") to be reachable.");
        long startTime = System.currentTimeMillis();
        while (!Pinger.isReachable(hostname, SSHPORT, 2000)) {
            ThreadUtils.sleep(1000);
            System.out.print(".");
            if (System.currentTimeMillis() - startTime > timeout) {
                System.out.println(instanceName + " (" + hostname + ")" + " timed out during reachability check.");
                return null;
            }
        }
        System.out.println();
        System.out.println(instanceName + " (" + hostname + ")" + " is reachable.");
        // associate the elasticIP if one is provided
        if (elasticIP != null) {
            System.out.println("Using ElasticIP " + elasticIP + " for instance " + instanceName + " (" + instanceID + ")");
            AWSEC2.associateAddress(ec2, elasticIP, instance);
            // get a new copy cuz things have changed
            instance = findInstance(ec2, instanceID);
            if (instance == null) {
                return null;
            }
            // recheck reachability
            hostname = instance.getPublicDnsName();
            System.out.println("Waiting " + timeout / 1000 + " s for " + instanceName + " (" + hostname + ", " + instanceID + ") to be reachable after Elastic IP change.");
            startTime = System.currentTimeMillis();
            while (!Pinger.isReachable(hostname, SSHPORT, 2000)) {
                ThreadUtils.sleep(1000);
                System.out.print(".");
                if (System.currentTimeMillis() - startTime > timeout) {
                    // give it a minute and ahalf
                    System.out.println(instanceName + " (" + hostname + ")" + " timed out during second (elastic IP) reachability check.");
                    return null;
                }
            }
            System.out.println();
            System.out.println(instanceName + " (" + hostname + ")" + " is still reachable.");
        }
        if (script != null) {
            File keyFile = new File(KEYHOME + FILESEPARATOR + keyName + PRIVATEKEYFILEEXTENSION);
            ExecuteBash.executeBashScript("ec2-user", hostname, keyFile, true, "installScript.sh", script);
        }
        return instance;
    } catch (AmazonServiceException ase) {
        System.out.println("Caught Exception: " + ase.getMessage());
        System.out.println("Reponse Status Code: " + ase.getStatusCode());
        System.out.println("Error Code: " + ase.getErrorCode());
        System.out.println("Request ID: " + ase.getRequestId());
    }
    return null;
}
Also used : Instance(com.amazonaws.services.ec2.model.Instance) AmazonServiceException(com.amazonaws.AmazonServiceException) SecurityGroup(com.amazonaws.services.ec2.model.SecurityGroup) File(java.io.File)

Example 67 with Instance

use of software.amazon.awssdk.services.ec2.model.Instance in project camel by apache.

the class AmazonEC2ClientMock method describeInstances.

@Override
public DescribeInstancesResult describeInstances(DescribeInstancesRequest describeInstancesRequest) {
    DescribeInstancesResult result = new DescribeInstancesResult();
    if (describeInstancesRequest.getInstanceIds().isEmpty()) {
        Collection<Reservation> list = new ArrayList<Reservation>();
        Reservation res = new Reservation();
        res.setOwnerId("1");
        res.setRequesterId("user-test");
        res.setReservationId("res-1");
        Collection<Instance> instances = new ArrayList();
        Instance ins = new Instance();
        ins.setImageId("id-1");
        ins.setInstanceType(InstanceType.T2Micro);
        ins.setInstanceId("instance-1");
        instances.add(ins);
        Instance ins1 = new Instance();
        ins1.setImageId("id-2");
        ins1.setInstanceType(InstanceType.T2Micro);
        ins1.setInstanceId("instance-2");
        instances.add(ins1);
        res.setInstances(instances);
        list.add(res);
        result.setReservations(list);
    } else {
        if (describeInstancesRequest.getInstanceIds().contains("instance-1")) {
            Collection<Reservation> list = new ArrayList<Reservation>();
            Reservation res = new Reservation();
            res.setOwnerId("1");
            res.setRequesterId("user-test");
            res.setReservationId("res-1");
            Collection<Instance> instances = new ArrayList();
            Instance ins = new Instance();
            ins.setImageId("id-1");
            ins.setInstanceType(InstanceType.T2Micro);
            ins.setInstanceId("instance-1");
            instances.add(ins);
            res.setInstances(instances);
            list.add(res);
            result.setReservations(list);
        }
    }
    return result;
}
Also used : DescribeInstancesResult(com.amazonaws.services.ec2.model.DescribeInstancesResult) Reservation(com.amazonaws.services.ec2.model.Reservation) Instance(com.amazonaws.services.ec2.model.Instance) ArrayList(java.util.ArrayList)

Example 68 with Instance

use of software.amazon.awssdk.services.ec2.model.Instance in project camel by apache.

the class AmazonEC2ClientMock method runInstances.

@Override
public RunInstancesResult runInstances(RunInstancesRequest runInstancesRequest) {
    RunInstancesResult result = new RunInstancesResult();
    if (runInstancesRequest.getImageId().equals("test-1")) {
        Reservation res = new Reservation();
        res.setOwnerId("1");
        res.setRequesterId("user-test");
        res.setReservationId("res-1");
        Collection<Instance> instances = new ArrayList();
        Instance ins = new Instance();
        ins.setImageId(runInstancesRequest.getImageId());
        ins.setInstanceType(runInstancesRequest.getInstanceType());
        ins.setInstanceId("instance-1");
        if (runInstancesRequest.getSecurityGroups() != null) {
            if (runInstancesRequest.getSecurityGroups().contains("secgroup-1") && runInstancesRequest.getSecurityGroups().contains("secgroup-2")) {
                GroupIdentifier id1 = new GroupIdentifier();
                id1.setGroupId("id-1");
                id1.setGroupName("secgroup-1");
                GroupIdentifier id2 = new GroupIdentifier();
                id2.setGroupId("id-2");
                id2.setGroupName("secgroup-2");
                Collection secGroups = new ArrayList<GroupIdentifier>();
                secGroups.add(id1);
                secGroups.add(id2);
                ins.setSecurityGroups(secGroups);
            } else if (ObjectHelper.isNotEmpty(runInstancesRequest.getKeyName())) {
                if (ObjectHelper.isNotEmpty(runInstancesRequest.getKeyName().contains("keypair-1"))) {
                    GroupIdentifier id1 = new GroupIdentifier();
                    id1.setGroupId("id-3");
                    id1.setGroupName("secgroup-3");
                    GroupIdentifier id2 = new GroupIdentifier();
                    id2.setGroupId("id-4");
                    id2.setGroupName("secgroup-4");
                    Collection secGroups = new ArrayList<GroupIdentifier>();
                    secGroups.add(id1);
                    secGroups.add(id2);
                    ins.setSecurityGroups(secGroups);
                }
            }
        }
        instances.add(ins);
        res.setInstances(instances);
        result.setReservation(res);
    } else {
        throw new AmazonServiceException("The image-id doesn't exists");
    }
    return result;
}
Also used : Reservation(com.amazonaws.services.ec2.model.Reservation) Instance(com.amazonaws.services.ec2.model.Instance) RunInstancesResult(com.amazonaws.services.ec2.model.RunInstancesResult) ArrayList(java.util.ArrayList) AmazonServiceException(com.amazonaws.AmazonServiceException) Collection(java.util.Collection) GroupIdentifier(com.amazonaws.services.ec2.model.GroupIdentifier)

Example 69 with Instance

use of software.amazon.awssdk.services.ec2.model.Instance in project photon-model by vmware.

the class AWSComputeDiskDay2ServiceTest method testDiskOperations.

/**
 * This test performs the following steps in sequence.
 * 1. provision a VM with one bootdisk, two new inline disks and one existing disk.
 * 2. Create three independent disks and then explicitly attach all of them to the VM
 * 3. Detach the first two disks that are explicitly attached.
 * 4. Delete VM(all the attached disks which are marked are not marked to persist will also be deleted).
 */
@Test
public void testDiskOperations() throws Throwable {
    Gson gson = new Gson();
    DiskState diskspec1 = createAWSDiskState(this.host, this.endpointState, this.currentTestName.getMethodName() + "_disk1", Boolean.FALSE, this.zoneId, regionId);
    // create a disk
    provisionSingleDisk(diskspec1);
    assertEquals(1, diskspec1.endpointLinks.size());
    // attach a disk while provisioning the vm
    provisionVMAndAttachDisk(this.zoneId, diskspec1.documentSelfLink, true);
    // check that the VM has been created
    ServiceDocumentQueryResult computeQueryResult = ProvisioningUtils.queryComputeInstances(this.host, 2);
    ComputeState vmStateAfterAttach1 = gson.fromJson(computeQueryResult.documents.get(this.vmState.documentSelfLink).toString(), ComputeState.class);
    Instance instance = null;
    if (!this.isMock) {
        List<Instance> instances = getAwsInstancesByIds(this.client, this.host, Collections.singletonList(vmStateAfterAttach1.id));
        instance = instances.get(0);
        ComputeState vm = this.host.getServiceState(null, ComputeState.class, UriUtils.buildUri(this.host, this.vmState.documentSelfLink));
        assertAndSetVMSecurityGroupsToBeDeleted(instance, vm);
        // verify that the disk is attached while provisioning the vm.
        DiskState attachedDisk1 = this.host.getServiceState(null, DiskState.class, UriUtils.buildUri(this.host, diskspec1.documentSelfLink));
        assertEquals("disk status not matching", DiskService.DiskStatus.ATTACHED, attachedDisk1.status);
        assertEquals(1, attachedDisk1.endpointLinks.size());
        this.volumeId = attachedDisk1.id;
    }
    ServiceDocumentQueryResult initialDiskQueryResult = ProvisioningUtils.queryDiskInstances(this.host, vmStateAfterAttach1.diskLinks.size());
    List<String> existingNames = new ArrayList<>();
    for (String diskLink : initialDiskQueryResult.documentLinks) {
        DiskState diskState = Utils.fromJson(initialDiskQueryResult.documents.get(diskLink), DiskState.class);
        existingNames.add(diskState.customProperties.get(AWSConstants.DEVICE_NAME));
    }
    ComputeState vmStateBeforeAttach = vmStateAfterAttach1;
    int numExternalDisks = 3;
    List<String> externallyProvisionedDisks = new ArrayList<>();
    ComputeState vmAfterExternalDiskAttach = createAndAttachExternalDisks(instance, existingNames, vmStateBeforeAttach, externallyProvisionedDisks, numExternalDisks);
    List<String> diskLinksToDetach = externallyProvisionedDisks.stream().filter(diskLink -> !diskLink.equals(externallyProvisionedDisks.get(numExternalDisks - 1))).collect(Collectors.toList());
    // detach disks from the vm and verify the details of the detached disks
    ComputeState vmStateAfterExplicitDetach = detachDiskAndVerify(vmAfterExternalDiskAttach, diskLinksToDetach, this.disksToCleanUp);
    assertEquals(5, vmStateAfterExplicitDetach.diskLinks.size());
    // On VM delete, two inline(Test_Volume_1 and Test_Volume_2), one non-inline external(*_disk1),
    // one external-disk should be deleted. Only one of the attached disks should be persisted.
    deleteVMAndVerifyDisks(vmStateAfterExplicitDetach.documentSelfLink, vmStateAfterExplicitDetach.diskLinks);
}
Also used : Arrays(java.util.Arrays) ProvisionComputeTaskService(com.vmware.photon.controller.model.tasks.ProvisionComputeTaskService) TestAWSSetupUtils.createAWSComputeHost(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.createAWSComputeHost) ServiceMetadata(com.vmware.photon.controller.model.util.StartServicesHelper.ServiceMetadata) PhotonModelServices(com.vmware.photon.controller.model.PhotonModelServices) VerificationHost(com.vmware.xenon.common.test.VerificationHost) TestAWSSetupUtils.createAWSResourcePool(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.createAWSResourcePool) TestAWSSetupUtils.tearDownTestVpc(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.tearDownTestVpc) DEVICE_NAME(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.DEVICE_NAME) TestAWSSetupUtils.setUpTestVpc(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.setUpTestVpc) ResourceOperationRequest(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperationRequest) CommandLineArgumentParser(com.vmware.xenon.common.CommandLineArgumentParser) Utils(com.vmware.xenon.common.Utils) TaskFactoryService(com.vmware.xenon.services.common.TaskFactoryService) StartServicesHelper(com.vmware.photon.controller.model.util.StartServicesHelper) Gson(com.google.gson.Gson) AWSBlockDeviceNameMapper(com.vmware.photon.controller.model.adapters.awsadapter.util.AWSBlockDeviceNameMapper) TestAWSSetupUtils.verifyRemovalOfResourceState(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.verifyRemovalOfResourceState) Duration(java.time.Duration) Map(java.util.Map) GroupIdentifier(com.amazonaws.services.ec2.model.GroupIdentifier) After(org.junit.After) ResourcePoolService(com.vmware.photon.controller.model.resources.ResourcePoolService) TestUtils.getExecutor(com.vmware.photon.controller.model.adapters.awsadapter.TestUtils.getExecutor) ProvisionDiskTaskService(com.vmware.photon.controller.model.tasks.ProvisionDiskTaskService) ServiceDocumentQueryResult(com.vmware.xenon.common.ServiceDocumentQueryResult) Collector(java.util.stream.Collector) ProvisioningUtils(com.vmware.photon.controller.model.tasks.ProvisioningUtils) EndpointState(com.vmware.photon.controller.model.resources.EndpointService.EndpointState) TestRequestSender(com.vmware.xenon.common.test.TestRequestSender) AWS_VM_REQUEST_TIMEOUT_MINUTES(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.AWS_VM_REQUEST_TIMEOUT_MINUTES) ResourceOperationResponse(com.vmware.photon.controller.model.adapterapi.ResourceOperationResponse) TestUtils(com.vmware.photon.controller.model.tasks.TestUtils) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) CompletionException(java.util.concurrent.CompletionException) SecurityGroup(com.amazonaws.services.ec2.model.SecurityGroup) Collectors(java.util.stream.Collectors) TestAWSSetupUtils.getResourceState(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.getResourceState) TestAWSSetupUtils.avalabilityZoneIdentifier(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.avalabilityZoneIdentifier) TestAWSSetupUtils.getSecurityGroupsIdUsingEC2Client(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.getSecurityGroupsIdUsingEC2Client) List(java.util.List) TestAWSSetupUtils.getAwsDisksByIds(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.getAwsDisksByIds) NetworkInterfaceService(com.vmware.photon.controller.model.resources.NetworkInterfaceService) AWSSupportedOS(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWSSupportedOS) ResourceOperation(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperation) UriUtils(com.vmware.xenon.common.UriUtils) TaskState(com.vmware.xenon.common.TaskState) FactoryService(com.vmware.xenon.common.FactoryService) DiskService(com.vmware.photon.controller.model.resources.DiskService) TaskService(com.vmware.xenon.services.common.TaskService) ServiceMetadata.factoryService(com.vmware.photon.controller.model.util.StartServicesHelper.ServiceMetadata.factoryService) TestAWSSetupUtils.deleteSecurityGroupUsingEC2Client(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.deleteSecurityGroupUsingEC2Client) PhotonModelMetricServices(com.vmware.photon.controller.model.PhotonModelMetricServices) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) TestAWSSetupUtils.getAwsInstancesByIds(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.getAwsInstancesByIds) AuthCredentialsService(com.vmware.xenon.services.common.AuthCredentialsService) UriPaths(com.vmware.photon.controller.model.UriPaths) TestProvisionAWSDisk.createAWSDiskState(com.vmware.photon.controller.model.adapters.awsadapter.TestProvisionAWSDisk.createAWSDiskState) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) TestName(org.junit.rules.TestName) Volume(com.amazonaws.services.ec2.model.Volume) PLACEMENT_LINK(com.vmware.photon.controller.model.ComputeProperties.PLACEMENT_LINK) DEVICE_TYPE(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.DEVICE_TYPE) Instance(com.amazonaws.services.ec2.model.Instance) Before(org.junit.Before) TestAWSSetupUtils.createAWSAuthentication(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.createAWSAuthentication) PhotonModelTaskServices(com.vmware.photon.controller.model.tasks.PhotonModelTaskServices) Assert.assertNotNull(org.junit.Assert.assertNotNull) AWSStorageType(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWSStorageType) Operation(com.vmware.xenon.common.Operation) SecurityGroupService(com.vmware.photon.controller.model.resources.SecurityGroupService) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) AWSSupportedVirtualizationTypes(com.vmware.photon.controller.model.adapters.awsadapter.AWSConstants.AWSSupportedVirtualizationTypes) TimeUnit(java.util.concurrent.TimeUnit) TestAWSSetupUtils.createAWSVMResource(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.createAWSVMResource) Rule(org.junit.Rule) TestContext(com.vmware.xenon.common.test.TestContext) PhotonModelAdaptersRegistryAdapters(com.vmware.photon.controller.model.adapters.registry.PhotonModelAdaptersRegistryAdapters) PhotonModelConstants(com.vmware.photon.controller.model.constants.PhotonModelConstants) TestAWSSetupUtils.regionId(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.regionId) TestAWSSetupUtils.setAwsClientMockInfo(com.vmware.photon.controller.model.adapters.awsadapter.TestAWSSetupUtils.setAwsClientMockInfo) IpPermission(com.amazonaws.services.ec2.model.IpPermission) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) AmazonEC2AsyncClient(com.amazonaws.services.ec2.AmazonEC2AsyncClient) ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) Instance(com.amazonaws.services.ec2.model.Instance) DiskState(com.vmware.photon.controller.model.resources.DiskService.DiskState) TestProvisionAWSDisk.createAWSDiskState(com.vmware.photon.controller.model.adapters.awsadapter.TestProvisionAWSDisk.createAWSDiskState) ArrayList(java.util.ArrayList) Gson(com.google.gson.Gson) ServiceDocumentQueryResult(com.vmware.xenon.common.ServiceDocumentQueryResult) Test(org.junit.Test)

Example 70 with Instance

use of software.amazon.awssdk.services.ec2.model.Instance in project photon-model by vmware.

the class AWSRebootServiceTest method testReboot.

// Test the reboot operation.
@Test
public void testReboot() throws Throwable {
    provisionSingleAWS();
    // check that the VM has been created
    ProvisioningUtils.queryComputeInstances(this.host, 2);
    ComputeState compute = getCompute(this.host, this.vmState.documentSelfLink);
    if (!this.isMock) {
        List<Instance> instances = getAwsInstancesByIds(this.client, this.host, Collections.singletonList(compute.id));
        Instance instance = instances.get(0);
        ComputeState vm = this.host.getServiceState(null, ComputeState.class, UriUtils.buildUri(this.host, this.vmState.documentSelfLink));
        assertAndSetVMSecurityGroupsToBeDeleted(instance, vm);
    }
    String taskLink = UUID.randomUUID().toString();
    ResourceOperationRequest request = new ResourceOperationRequest();
    request.isMockRequest = this.isMock;
    request.operation = ResourceOperation.REBOOT.operation;
    request.payload = new HashMap<>();
    request.resourceReference = UriUtils.buildUri(this.host, compute.documentSelfLink);
    request.taskReference = UriUtils.buildUri(this.host, taskLink);
    TestContext ctx = this.host.testCreate(2);
    createTaskResultListener(this.host, taskLink, (u) -> {
        if (u.getAction() != Service.Action.PATCH) {
            return false;
        }
        ResourceOperationResponse response = u.getBody(ResourceOperationResponse.class);
        if (TaskState.isFailed(response.taskInfo)) {
            ctx.failIteration(new IllegalStateException(response.taskInfo.failure.message));
        } else if (TaskState.isFinished(response.taskInfo)) {
            ctx.completeIteration();
        }
        return true;
    });
    Operation rebootOp = Operation.createPatch(UriUtils.buildUri(this.host, AWSRebootService.SELF_LINK)).setBody(request).setReferer(this.host.getReferer()).setCompletion((o, e) -> {
        if (e != null) {
            ctx.failIteration(e);
            return;
        }
        ctx.completeIteration();
    });
    this.host.send(rebootOp);
    ctx.await();
    ComputeState vm = this.host.getServiceState(null, ComputeState.class, UriUtils.buildUri(this.host, this.vmState.documentSelfLink));
    assertEquals(ComputeService.PowerState.ON, vm.powerState);
}
Also used : ComputeState(com.vmware.photon.controller.model.resources.ComputeService.ComputeState) ResourceOperationResponse(com.vmware.photon.controller.model.adapterapi.ResourceOperationResponse) Instance(com.amazonaws.services.ec2.model.Instance) TestContext(com.vmware.xenon.common.test.TestContext) ResourceOperationRequest(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperationRequest) ResourceOperation(com.vmware.photon.controller.model.adapters.registry.operations.ResourceOperation) Operation(com.vmware.xenon.common.Operation) Test(org.junit.Test)

Aggregations

Instance (com.amazonaws.services.ec2.model.Instance)86 ArrayList (java.util.ArrayList)43 Reservation (com.amazonaws.services.ec2.model.Reservation)39 DescribeInstancesResult (com.amazonaws.services.ec2.model.DescribeInstancesResult)31 List (java.util.List)23 DescribeInstancesRequest (com.amazonaws.services.ec2.model.DescribeInstancesRequest)22 HashMap (java.util.HashMap)22 ComputeState (com.vmware.photon.controller.model.resources.ComputeService.ComputeState)18 Operation (com.vmware.xenon.common.Operation)18 Tag (com.amazonaws.services.ec2.model.Tag)17 Map (java.util.Map)17 Test (org.junit.Test)16 Filter (com.amazonaws.services.ec2.model.Filter)14 HashSet (java.util.HashSet)13 Volume (com.amazonaws.services.ec2.model.Volume)12 Utils (com.vmware.xenon.common.Utils)12 TimeUnit (java.util.concurrent.TimeUnit)12 AmazonEC2AsyncClient (com.amazonaws.services.ec2.AmazonEC2AsyncClient)11 SecurityGroup (com.amazonaws.services.ec2.model.SecurityGroup)11 ComputeService (com.vmware.photon.controller.model.resources.ComputeService)10