Example usage for com.amazonaws.auth InstanceProfileCredentialsProvider refresh

List of usage examples for com.amazonaws.auth InstanceProfileCredentialsProvider refresh

Introduction

In this page you can find the example usage for com.amazonaws.auth InstanceProfileCredentialsProvider refresh.

Prototype

@Override
    public void refresh() 

Source Link

Usage

From source file:com.erudika.para.utils.Config.java

License:Apache License

private static String[] getAwsCredentials() {
    InstanceProfileCredentialsProvider ipcp = new InstanceProfileCredentialsProvider();
    try {//  w w  w.  ja  va 2 s.c  o  m
        ipcp.refresh();
        return new String[] { ipcp.getCredentials().getAWSAccessKeyId(),
                ipcp.getCredentials().getAWSSecretKey() };
    } catch (Exception e) {
        return new String[] { "", "" };
    }
}