Deletes a subnet from a VPC. You must terminate all running instances in the subnet before deleting it, otherwise Amazon VPC returns an error.
888990919293949596979899
return additionalWorkerAllocated; } private void launchInstance(String instanceId) { StartInstancesRequest startInstancesRequest = new StartInstancesRequest(); List<String> instancesIdsToLaunch = new ArrayList<String>(); instancesIdsToLaunch.add(instanceId); startInstancesRequest.setInstanceIds(instancesIdsToLaunch); ec2Client.startInstances(startInstancesRequest); updateInstanceState(instanceId, "running"); }
165166167168169170171172173174175176177
} private Image newImageWithStatus(final String state, final String code, final String message) { final StateReason reason = new StateReason(); reason.setCode(code); reason.setMessage(message); final Image image = new Image(); image.setState(state); image.setStateReason(reason);
3334353637383940
public void stopInstance() throws ClientProtocolException, IOException { String instanceId = getInstanceId(); List<String> instancesId = new ArrayList<String>(); instancesId.add(instanceId); StopInstancesRequest stopInstancesRequest = new StopInstancesRequest(instancesId); amazonEC2Client.stopInstances(stopInstancesRequest); }
165166167168169170171172173174175
private void addTag(AmazonEC2Client ec2, NetworkInterface o, String key, String value) { addTag(ec2, o.getNetworkInterfaceId(), key, value); } private void addTag(AmazonEC2Client ec2, String id, String key, String value) { Tag tag = new Tag(key, value); List<Tag> tags = Lists.newArrayList(); tags.add(tag); CreateTagsRequest request = new CreateTagsRequest(); request.setResources(Collections.singletonList(id));
8384858687888990919293
final Collection<String> resourceList = new ArrayList<String>(1); resourceList.add(resourceId); final Collection<Tag> tagList = new ArrayList<Tag>(1); tagList.add(new Tag(key, value)); request.setResources(resourceList); request.setTags(tagList); logger.info("tag create request=" + request);
103104105106107108109110111112113
final Collection<String> resourceList = new ArrayList<String>(1); resourceList.add(resourceId); final Collection<Tag> tagList = new ArrayList<Tag>(1); tagList.add(new Tag(key, value)); request.setResources(resourceList); request.setTags(tagList); logger.info("tag delete request=" + request);
117118119120121122123124
* * @param instanceIds */ public static void terminateInstances(List<String> instanceIds) { // terminate TerminateInstancesRequest request = new TerminateInstancesRequest(instanceIds); getEC2Client().terminateInstances(request); }
128129130131132133134135
* * @param instanceIds */ public static void terminateInstances(String... instanceIds) { // terminate TerminateInstancesRequest request = new TerminateInstancesRequest(); getEC2Client().terminateInstances(request.withInstanceIds(instanceIds)); }
167716781679168016811682168316841685
* Returns the marshaled request configured with additional parameters to * enable operation dry-run. */ @Override public Request<RunInstancesRequest> getDryRunRequest() { Request<RunInstancesRequest> request = new RunInstancesRequestMarshaller().marshall(this); request.addParameter("DryRun", Boolean.toString(true)); return request; }
167216731674167516761677167816791680