简体   繁体   中英

How to call s3 bucket from ECS container via aws sdk (java) by using IAM role

I need to read a file from s3 bucket from ECS container by using aws sdk. What are the best option available?. I tried initializing aws client with default aws creds give but that did not work. I followed https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/ec2-iam-roles.html but InstanceProfileCredentialsProvider is also depreciated.

Try the below snippet to create an object and put the detail of the error you are getting

S3Client s3Client = S3Client.builder().region(<>).build();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM