java


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

Related Links

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

Categories

HOME
clips
webpack
azure-data-factory
lodash
office365api
objectgears
sd-card
google-docs
sqlite-net-extensions
filtering
spring-jdbc
malloc
jpeg
sql-server-2016
flyway4
indesign
multiple-records
pheatmap
contact
medical
facebook-php-sdk
vifm
adobe-analytics
spring-kafka
dax
handsontable
u-sql
windows-phone-7
leiningen
orchardcms
fallback
ups
try-catch
dosgi
finite-automata
flux
cx-freeze
java-3d
riot.js
intentfilter
tapestry
devops
trading
vlsi
django-storage
kannel
web-api-testing
jspm
subdomains
delicious-api
google-rich-snippets
uisplitview
gtrendsr
gammu
mmenu
hexo
space-complexity
streamreader
ensembles
heightmap
qwt
menuitem
user-accounts
appcompat
hendrix
recursive-datastructures
mcafee
pintos
medium.com
nxt
jwplayer7
blackberry-10
make-install
javax.sound.midi
iad
intel-fortran
qdialog
wireshark-dissector
sailfish-os
oberon
inmobi
csquery
relocation
onactivityresult
eol
yorick
braille
undefined-reference
transcoding
floating-point-precision
inbox
google-cloud-save
rdoc
chrono
osql
hgsubversion
custom-backend
mod-auth
servicehost
oncheckedchanged
blitz++
ext3
web-architecture
memory-size
nerddinner
data-acquisition

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App