List of usage examples for com.amazonaws.services.ec2 AmazonEC2 getConsoleOutput
GetConsoleOutputResult getConsoleOutput(GetConsoleOutputRequest getConsoleOutputRequest);
Gets the console output for the specified instance.
From source file:com.axemblr.provisionr.amazon.activities.DumpConsoleOutput.java
License:Apache License
@Override public void execute(AmazonEC2 client, Pool pool, DelegateExecution execution) throws Exception { Machine machine = (Machine) execution.getVariable("machine"); checkNotNull(machine, "expecting 'machine' as a process variable"); LOG.info(">> Requesting console output for instance {}", machine.getExternalId()); GetConsoleOutputResult result = client .getConsoleOutput(new GetConsoleOutputRequest().withInstanceId(machine.getExternalId())); String content = new String(Base64.decode(result.getOutput()), Charsets.UTF_8); LOG.info("<< Console output for instance {}: {}", machine.getExternalId(), content); }
From source file:hudson.plugins.ec2.EC2Computer.java
License:Open Source License
/** * Gets the EC2 console output./*from www . j ava2s . c o m*/ */ public String getConsoleOutput() throws AmazonClientException { AmazonEC2 ec2 = getCloud().connect(); GetConsoleOutputRequest request = new GetConsoleOutputRequest(getInstanceId()); return ec2.getConsoleOutput(request).getOutput(); }
From source file:org.apache.provisionr.amazon.activities.DumpConsoleOutput.java
License:Apache License
@Override public void execute(AmazonEC2 client, Pool pool, DelegateExecution execution) throws IOException { Machine machine = (Machine) execution.getVariable("machine"); checkNotNull(machine, "expecting 'machine' as a process variable"); LOG.info(">> Requesting console output for instance {}", machine.getExternalId()); GetConsoleOutputResult result = client .getConsoleOutput(new GetConsoleOutputRequest().withInstanceId(machine.getExternalId())); if (result.getOutput() != null) { String content = new String(Base64.decode(result.getOutput()), Charsets.UTF_8); LOG.info("<< Console output for instance {}: {}", machine.getExternalId(), content); } else {/*from www . jav a 2 s. c o m*/ LOG.warn("<< Console output was null for instance {}", machine.getExternalId()); } }