Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS LAMBDA using java sdk SES Client times out

I have a very basic lambda function to send email
The Code hangs on creating SES Client .i put logs before and after this statement of creating client .

AmazonSimpleEmailService client = AmazonSimpleEmailServiceClientBuilder.standard().withRegion(Regions.EU_WEST_1)
          .withCredentials(new InstanceProfileCredentialsProvider(false)).build();

i also tried

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

The lambda function assumes IAM role with AmazonSESFullAccess , any one could point to resolution why do i get timeout here trying to initiate client ?

like image 776
Ameen Avatar asked Feb 26 '26 19:02

Ameen


1 Answers

To fix the issue of Credentials creation times out as suggested in reply i tried

NO VPC , increased timeout from default 3 to 10 seconds, and increased mem to 960MB

Creating Service sdk client in java use EnvironmentVariableCredentialsProvider() for LAMBDA that fixed the Client Initialisation problem of for EC2 use InstanceProfileCredentialsProvider(true)

Unable to load credentials from service endpoint

AmazonSimpleEmailService client =

AmazonSimpleEmailServiceClientBuilder.standard().withRegion(Regions.EU_WEST_1) .withCredentials(new EnvironmentVariableCredentialsProvider()).build();

thanks a lot for help ...

like image 100
Ameen Avatar answered Feb 28 '26 12:02

Ameen