List of usage examples for com.amazonaws.services.ec2.model InstanceType toString
@Override
public String toString()
From source file:com.pinterest.arcee.handler.SpecsHandler.java
License:Apache License
public List<String> getInstanceTypes() { List<String> instanceTypes = new LinkedList<>(); for (InstanceType type : InstanceType.values()) { instanceTypes.add(type.toString()); }//from ww w . j a va 2s . c om return instanceTypes; }
From source file:com.yosanai.java.aws.console.DefaultAWSConnectionProvider.java
License:Open Source License
@Override public void launchInstance(String amiId, InstanceType instanceType, int instanceCount, String keyName, Collection<String> securityGroups, boolean terminateViaAPI, Map<String, String> tags) throws Exception { if (1 > instanceCount) { throw new Exception("Invalid instanceCount " + instanceCount); }//from w w w.j av a2s . c o m if (null == instanceType) { throw new Exception("Invalid instanceType"); } if (StringUtils.isBlank(amiId)) { throw new Exception("Invalid amiId"); } RunInstancesRequest runInstancesRequest = new RunInstancesRequest(amiId, instanceCount, instanceCount); runInstancesRequest.setKeyName(keyName); runInstancesRequest.setSecurityGroups(securityGroups); runInstancesRequest.setDisableApiTermination(!terminateViaAPI); runInstancesRequest.setInstanceType(instanceType.toString()); RunInstancesResult result = getConnection().runInstances(runInstancesRequest); if (null != tags && !tags.isEmpty()) { List<Tag> tagList = new ArrayList<Tag>(); for (String key : tags.keySet()) { tagList.add(new Tag(key, tags.get(key))); } List<String> resources = new ArrayList<String>(); Reservation reservation = result.getReservation(); for (Instance instance : reservation.getInstances()) { resources.add(instance.getInstanceId()); } getConnection().createTags(new CreateTagsRequest(resources, tagList)); } }
From source file:eu.optimis.interopt.provider.aws.AmazonClient.java
License:Apache License
public InstanceType selectInstanceType(ServiceComponent sc) { double mem = sc.getMemory(); int cores = sc.getCores(); String arch = sc.getArchitecture(); InstanceType res; if (isOfType(InstanceType.T1Micro, mem, cores, arch)) { res = InstanceType.T1Micro;// w ww . j a va 2s . c o m } else if (isOfType(InstanceType.M1Small, mem, cores, arch)) { res = InstanceType.M1Small; } else if (isOfType(InstanceType.M1Medium, mem, cores, arch)) { res = InstanceType.M1Medium; } else if (isOfType(InstanceType.M1Large, mem, cores, arch)) { res = InstanceType.M1Large; } else if (isOfType(InstanceType.M1Xlarge, mem, cores, arch)) { res = InstanceType.M1Xlarge; } else { res = InstanceType.M32xlarge; } log.info("Selected instance type: " + res.toString()); //return res; return InstanceType.T1Micro;// ONLY FOR TESTING!!!!! }
From source file:jp.primecloud.auto.process.aws.AwsInstanceTypeDefinition.java
License:Open Source License
public static void addInstanceStoreCount(InstanceType instanceType, int count) { addInstanceStoreCount(instanceType.toString(), count); }