简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM