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

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

Categories

HOME
testing
multithreading
client
gitlab
listview
proxy
server
objectgears
jsp-tags
fsm
ojdbc
enterprise-library-5
constraint-programming
slick-slider
iggrid
nano-server
reveal.js
modelica
google-cloud-spanner
quartz-scheduler
ghc
foselasticabundle
sms-gateway
abi
mps
angular2-aot
phpfox
filezilla
maquette
log4js-node
google-cloud-nl
unboundid
stormpath
javascriptcore
titanium-mobile
noraui
openoffice.org
ghost4j
http-referer
cloud-code
bower-install
bytecode-manipulation
android-ble
web-mining
x11-forwarding
bootstrapper
sas-visual-analytics
mesos-chronos
dynamic-reports
firebase-admin
outlook-api
flashair
scorm
long-polling
dotcover
upstart
python-c-api
typescript1.8
sage-one
aurelia-validation
nstextview
composite-key
r-forge
spring-mongodb
titanium-android
webdriverjs
minimization
time-and-attendance
xcb
infix-notation
autorest
storekit
jwplayer7
pagedlist
sigabrt
make-install
packagist
ipconfig
two-factor-authentication
freedesktop.org
xna-4.0
msys
cyclomatic-complexity
wordml
deis
iiviewdeckcontroller
composite
csquery
typeof
system.net.webexception
industrial
floating-point-precision
web2py-modules
random-seed
angularjs-controller
coderush
frameset
parametric-equations
ticoredatasync
osql
gnustep
android-sdk-2.1
uimenucontroller
project-hosting
w3wp
geneva-server

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