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
Why does this Query return NULL?
How to compare password with the password which is encrypted and stored in DB, when user enters for login
The registered message body readers compatible with the MIME media type are: application/json;charset=UTF-8
Liferay 6 persistent sessions with very large table
Access to neo4j-ogm's mapping context
Japser Report Gantt XSD not matching supported features
How to fix the Hibernate metamodel class' issues Make this “public static id” field final which is raised by Sonar
Java authentication - - pattern for element-level Auth?
Android: How to know inherited defualt values of properties of widget so we can override in styles and themes
How to get the TimeZoneOffset ID from TimeZone value in Java 8?
My app keeps crashing, SQLite database leak error
Cannot update UI from AsyncTask
RSA using BigInteger class
User input using Scanner class
not able to display binary tree
Java get X, Y, Width, Height cords from an Image in Slick2D