Issue with authentication from Java Spring to AWS SES service

0

I have a Spring Boot app where at some occasions I am sending automated emails. My App is hosted on AWS ECS(Fargate) and is using AWS SES for sending emails. I added a role to my Fargate task with all needed permissions for AWS SES. Most of the times, app is able to authenticate and send emails correctly however at some occasions authentication fails and because of that email/s are not send. The error I am receiving is:

Unable to load AWS credentials from any provider in the chain: EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)), SystemPropertiesCredentialsProvider: Unable to load AWS credentials from Java system properties (aws.accessKeyId and aws.secretKey), WebIdentityTokenCredentialsProvider: To use assume role profiles the aws-java-sdk-sts module must be on the class path., com.amazonaws.auth.profile.ProfileCredentialsProvider@6fa01606: profile file cannot be null, com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@4ca2c1d: Failed to connect to service endpoint

Now, if this would happen each time I would conclude that I configured something incorrectly. However, since authentication fails only sometimes I am not sure what the problem is.

I am using the following aws-sdk version: 1.12.197 When I am building a client, I am doing it on the following way:

AmazonSimpleEmailService client = AmazonSimpleEmailServiceClientBuilder.standard() .withRegion(Regions.US_EAST_1).build();

Thank you for help.

asked 2 years ago79 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions