SdkClientException: Unable to execute HTTP request: Connection refused

My Java app suddenly unable to send email using Amazon SES (AWS region us-west-1):

HTTP request: Connection refused (Connection refused)): software.amazon.awssdk.core.exception.SdkClientException: Unable to execute HTTP request: Connection refused (Connection refused)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:98)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.exception.SdkClientException.create(SdkClientException.java:43)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.pipeline.stages.utils.RetryableStageHelper.setLastException(RetryableStageHelper.java:204)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:83)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.pipeline.stages.RetryableStage.execute(RetryableStage.java:36)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:56)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.StreamManagingStage.execute(StreamManagingStage.java:36)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.executeWithTimer(ApiCallTimeoutTrackingStage.java:80)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:60)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallTimeoutTrackingStage.execute(ApiCallTimeoutTrackingStage.java:42)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallMetricCollectionStage.execute(ApiCallMetricCollectionStage.java:48)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.pipeline.stages.ApiCallMetricCollectionStage.execute(ApiCallMetricCollectionStage.java:31)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.pipeline.RequestPipelineBuilder$ComposingRequestPipelineStage.execute(RequestPipelineBuilder.java:206)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:37)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.pipeline.stages.ExecutionFailureExceptionReportingStage.execute(ExecutionFailureExceptionReportingStage.java:26)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.http.AmazonSyncHttpClient$RequestExecutionBuilderImpl.execute(AmazonSyncHttpClient.java:193)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.invoke(BaseSyncClientHandler.java:103)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.doExecute(BaseSyncClientHandler.java:167)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.lambda$execute$1(BaseSyncClientHandler.java:82)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.measureApiCallSuccess(BaseSyncClientHandler.java:175)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.internal.handler.BaseSyncClientHandler.execute(BaseSyncClientHandler.java:76)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.core.client.handler.SdkSyncClientHandler.execute(SdkSyncClientHandler.java:45)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.awscore.client.handler.AwsSyncClientHandler.execute(AwsSyncClientHandler.java:56)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.services.ses.DefaultSesClient.sendTemplatedEmail(DefaultSesClient.java:3883)
2022-04-24T17:56:09Z app[0e57d191] sjc [info]   at software.amazon.awssdk.services.ses.SesClientProducer_ProducerMethod_client_f0f3dcec0eb23dd4d306f0aa60e8d75af265eea6_ClientProxy.sendTemplatedEmail(Unknown Source)

It used to work, and it still works locally.

The env var secrets (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) are in place. I tried fly secret unset, throws different error, which means they got picked up.

What could be the issue?

“Connection refused” means Amazon is rejecting the connection, probably before auth even happens. Do you know what http url that’s trying to hit? It’s possible it’s behaving differently over IPv6 than it does over IPv4.