Example usage for com.amazonaws.auth.profile ProfileCredentialsProvider ProfileCredentialsProvider

List of usage examples for com.amazonaws.auth.profile ProfileCredentialsProvider ProfileCredentialsProvider

Introduction

In this page you can find the example usage for com.amazonaws.auth.profile ProfileCredentialsProvider ProfileCredentialsProvider.

Prototype

public ProfileCredentialsProvider(String profileName) 

Source Link

Document

Creates a new profile credentials provider that returns the AWS security credentials configured for the named profile.

Usage

From source file:tools.descartes.bungee.cloud.aws.AWSImpl.java

License:Apache License

private void init() {
    AWSCredentials credentials = null;//from w  w  w  .j  a  v a2  s .  c  om
    try {
        credentials = new ProfileCredentialsProvider("default").getCredentials();
    } catch (Exception e) {
        throw new AmazonClientException("Cannot load the credentials from the credential profiles file. "
                + "Please make sure that your credentials file is at the correct "
                + "location (C:\\Users\\<Username>\\.aws\\credentials), and is in valid format.", e);
    }
    elasticLB = new AmazonElasticLoadBalancingClient(credentials);
    elasticLB.setEndpoint(LB_END_POINT_NAME);
    ec2 = new AmazonEC2Client(credentials);
    ec2.setEndpoint(EC2_END_POINT_NAME);
    autoScale = new AmazonAutoScalingClient(credentials);
    autoScale.setEndpoint(AUTOSCALING_END_POINT_NAME);
}