Example usage for com.amazonaws.services.ec2.model RunInstancesRequest setRequestCredentials

List of usage examples for com.amazonaws.services.ec2.model RunInstancesRequest setRequestCredentials

Introduction

In this page you can find the example usage for com.amazonaws.services.ec2.model RunInstancesRequest setRequestCredentials.

Prototype

@Deprecated
public void setRequestCredentials(AWSCredentials credentials) 

Source Link

Document

Sets the optional credentials to use for this request, overriding the default credentials set at the client level.

Usage

From source file:net.maxgigapop.www.rains.experiment.AwsTest1.java

public static void main(String[] args) {
    try {/*from   www  .  j a  v a  2 s  .c  o  m*/
        // marshall contractXml
        RunInstancesRequest runInstance = new RunInstancesRequest();
        runInstance.withImageId("ami-146e2a7c").withInstanceType("t2.micro").withMaxCount(1).withMinCount(1);
        List<InstanceNetworkInterfaceSpecification> networkInterfaceSpecifications = new ArrayList();
        runInstance.withNetworkInterfaces(networkInterfaceSpecifications);
        runInstance.setGeneralProgressListener(null);
        runInstance.setRequestCredentials(null);
        String xml = new JAXBHelper<RunInstancesRequest>(RunInstancesRequest.class).partialMarshal(runInstance,
                new QName("http://maxgigapop.net/versastack/aws/api/", "RunInstancesRequest"));
        System.out.println("RunInstancesRequest mashaled:\n" + xml);
    } catch (JAXBException ex) {
        System.err.println(ex.toString());
    }
}