Sunny
Sunny

Reputation: 36

How to get temporary security credential from AWS to access s3 bucket and upload files by using java?

I referred to this https://github.com/awsdocs/amazon-s3-developer-guide/blob/master/doc_source/AuthUsingTempFederationTokenJava.md link but it shows a profile error that the profile file should not be null. another I referred this https://docs.aws.amazon.com/AmazonS3/latest/userguide/AuthUsingTempSessionToken.html even this doesn't work for me. any suggestion?

Upvotes: 0

Views: 918

Answers (1)

kgiannakakis
kgiannakakis

Reputation: 104198

For both links you need to follow the instructions and not just copy/paste the code. The profile is null, because you most probably haven't created a ~/.aws/credentials file.

The process to test the code should be:

  • Create an IAM user, assign the appropriate permissions and create access keys
  • Add a profile to the ~/aws/credentials file with the keys of the user
  • Use the profile like new ProfileCredentialsProvider("app-1-development") in your code.

Please also refer here

Upvotes: 1

Related Questions