admin管理员组文章数量:1122846
I want to set the Environment variables-AWS_ACCESS_KEY_ID, AWS_SECRET_KEY or AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN
BasicSessionCredentials awsCreds = new BasicSessionCredentials("access_key_id", "secret_key_id", "session_token");
AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
.build();
but from the console I only have the AWS_ACCESS_KEY_ID, AWS_SECRET_KEY, not the token:
I want to set the Environment variables-AWS_ACCESS_KEY_ID, AWS_SECRET_KEY or AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN
BasicSessionCredentials awsCreds = new BasicSessionCredentials("access_key_id", "secret_key_id", "session_token");
AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
.build();
but from the console I only have the AWS_ACCESS_KEY_ID, AWS_SECRET_KEY, not the token:
Share Improve this question edited yesterday Nuñito Calzada asked yesterday Nuñito CalzadaNuñito Calzada 2,24253 gold badges197 silver badges326 bronze badges1 Answer
Reset to default 0Two things:
- Use BasicAWSCredentials to pass just an accessKey and secretKey. The session one isn't needed for simple applications. It's used for short term / temporary credentials and if you're just starting out, keep it simple.
- You're using version 1 of the Java SDK if you're using BasicSessionCredentials. While Amazon still supports version 1 of the Java SDK they have already stopped general support and will drop all support at the end of 2025. The AWS Java SDK version 2 has been out for quite some time and is super stable - I'd strongly encourage you to use it instead.
本文标签: springcredentials to the AWS SDK 112780 for JavaStack Overflow
版权声明:本文标题:spring - credentials to the AWS SDK 1.12.780 for Java - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736283661a1927035.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论