Initialization
We need the AWS credentials to access Amazon Web Services for using the API tools. We will check out two ways to get an instance of com.amazonaws.auth.AWSCredentials
:
- Using
BasicAWSCredentials
- Using
ProfileCredentialsProvider
Using BasicAWSCredentials
BasicAWSCredentials
is a vanilla flavor implementation class for providing the AWS credentials, which are the access key and the secret key:
// Class Variable protected AWSCredentials credentials = null; .... public void initializeAWSCredentials(){ credentials = new BasicAWSCredentials("ACCESS_ID", "SECRET_KEY"); }
Replace ACCESS_ID
and SECRET_KEY
with your actual access id and secret key.
Using ProfileCredentialsProvider
ProfileCredentialsProvider
provides AWSCredentials
. It accesses the ...
Get Amazon S3 Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.