Use role_arn defined in aws config file in Java
I have a Java code which creates a s3Client object to perform bucket operations. I have a credentials file with the following data under /root/.aws/ folder, [default] aws_access_key_id = <the key> aws_secret_access_key = <the key> Most recently, the bucket policies got updated and the following details were added in a config file under the same directory, [default] role_arn = arn:aws:iam::<id>:role/<role_name> source_profile = default output = text region = region-name My application is not able to consume the role_arn from the config file, and can not do any bucket operations. Does AWS provides any classes to read the config file directly, I do not want to hardcode the role_arn and region values in the code. I see ProfilesConfigFile for reading what is there in the credentials file, but nothing for the contents of the config file.
AWS CLI uses config file (~/.aws/config) for delegating profiles using role_arn/region. So your cli operations with --profile default would work fine.As per this feature request role assumption as specified in config file is incompatible with AWS SDK. When you initialize s3Client as below it uses S3CredentialProviderChain which simply extends DefaultAWSCredentialsProviderChain for retrieving credentials from ~/.aws/credentials. Workaround to make your application is to load the config(~/.aws/config) file in application and make an assume request with the specified role_arn. example
What is the most performant way to ensure thread safety in a Spring component?
Access Libre office headless service of Unix on windows
Convert my JSP Scriptlet code to EL
Why a Scanner class object needs to be close and a string class object can't? [closed]
Apache MINA server closes active UDP “session” after 60s
POI evaluate formulas
Better have two separate methods or one method call the other?
Component testing approach
Tomcat doesn't run if “metadata-complete” is set as false
Different display of components in my phone screen
Having one thread acquire multiple objects from a shared list
How should the parameter of the main method be documented [closed]
Initialize extended class through base class factory in Java
java overridden method not getting called
JavaFX - Why does adding a node to a pane multiple times or to different panes result in an error?
Cannot call Bitcoin RPC from Jersey HttpClient