Spring AWS SES 身份验证启动问题

Spring Boot issue with AWS SES authentication

我有一个 Spring 启动应用程序,有时我会在其中发送自动电子邮件。我的应用程序托管在 AWS ECS(Fargate) 上,并使用 AWS SES 发送电子邮件。我向我的 Fargate 任务添加了一个角色,它具有 AWS SES 所需的所有权限。大多数情况下,该应用程序能够正确验证和发送电子邮件,但在某些情况下验证失败,因此 email/s 不会发送。我收到的错误是:

> 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

现在,如果每次都发生这种情况,我会断定我配置不正确。但是,由于身份验证只是有时会失败,所以我不确定是什么问题。

我正在使用以下 aws-sdk 版本:1.12.197 当我初始化客户端时,我是按以下方式进行的:

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

有谁知道为什么身份验证有时会失败?

感谢您的帮助。

我的一个 ECS 任务似乎使用了旧版本的任务定义,并且没有设置正确的权限。我更新后好像没问题