public class ProfilesConfigFile extends Object
AWS_CONFIG_FILE
environment variable or by specifying an
alternate config file location through this class' constructor.
The AWS config file format allows you to specify multiple profiles, each with their own set of AWS security credentials:
[default] aws_access_key_id=testAccessKey aws_secret_access_key=testSecretKey [profile test-user] aws_access_key_id=testAccessKey aws_secret_access_key=testSecretKey
These configuration profiles allow you to share multiple sets of AWS security credentails between different tools such as the AWS SDK for Java and the AWS CLI.
For more information on setting up AWS configuration profiles, see: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
ProfileCredentialsProvider
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_PROFILE_NAME
Name of the default profile as specified in the configuration file.
|
Constructor and Description |
---|
ProfilesConfigFile()
Loads the AWS profiles config file from the default location
(~/.aws/config) or from an alternate location if
AWS_CONFIG_FILE is set. |
ProfilesConfigFile(File file)
Loads the AWS profiles from the file.
|
ProfilesConfigFile(String filePath)
Loads the AWS config profiles from the file.
|
Modifier and Type | Method and Description |
---|---|
AWSCredentials |
getCredentials(String profile)
Returns the AWS Credentials for the specified profile.
|
public static final String DEFAULT_PROFILE_NAME
public ProfilesConfigFile() throws AmazonClientException
AWS_CONFIG_FILE
is set.AmazonClientException
public ProfilesConfigFile(String filePath)
public ProfilesConfigFile(File file) throws AmazonClientException
AmazonClientException
public AWSCredentials getCredentials(String profile)
Copyright © 2014. All rights reserved.