Victor
Victor

Reputation: 1

JAVA -AWS ACCESS S3 BUCKET FROM JAVA APPLICATION ON ELASTIC BEANSTALK

I want to upload files from my Java Spring application to S3 bucket.

After configure credentials in ./aws/credentials this work for me on localhost.

But, I tried on Elastic Beanstalk but not working. I receive the message "Permission denied".

I configure the aws-elasticbeanstalk-ec2-role to grant access to AmazonS3FullAccess, and configure enviroment properties from Sowtware configuration on Elastic Beanstalk application.

My code to initialize AmazonClient:

this.s3client = AmazonS3ClientBuilder.standard().withForceGlobalBucketAccessEnabled(true) .build();

aws-elasticbeanstalk-ec2-role Configuration:

View here

Am I skipping something?

Upvotes: 0

Views: 743

Answers (2)

smac2020
smac2020

Reputation: 10724

Looks like you are not setting the environment variables on Elastic Beanstalk and setting the Service Clients properly. Read this AWS Tutorial. It shows you how to interact with Amazon S3 from a Spring Boot application.

Creating an example AWS photo analyzer application using the AWS SDK for Java

Upvotes: 0

pgd
pgd

Reputation: 116

Did You check security group on ec2? Because as You probably know ElasticBeanstalk create EC2 instance as well. Maybe You block outbound traffic?

Upvotes: 0

Related Questions