- Newest
- Most votes
- Most comments
Hi,
I would strongly suggest that you read this blog post about sending emails with SES VPC endpoint: https://aws.amazon.com/blogs/aws/new-amazon-simple-email-service-ses-for-vpc-endpoints/
It will allow you to verify that your setup is correct.
In particular, note in final verification section that dns used to send email remains identical to SES with public endpoint:
openssl s_client -crlf -quiet -starttls smtp -connect email-smtp.ap-southeast-2.amazonaws.com:587
I would strongly encourage you to test the vpc endpoint via a temporary EC2 instance in your VPC that you'll use to do the final verification section with openssl in your context.
Best,
Didier
Based on the information provided, it appears you're encountering a common issue when trying to send emails using Amazon SES through a VPC endpoint from an AWS Batch job. Here are some additional steps and considerations to help resolve the timeout error:
-
Double-check the security group settings:
- Ensure that the security group associated with your VPC endpoint allows inbound traffic on port 587 (for STARTTLS) or 465 (for TLS Wrapper) from the security group used by your AWS Batch jobs.
- Verify that the security group for your AWS Batch jobs allows outbound traffic to the VPC endpoint on the same ports.
-
Review the VPC endpoint policy:
- Make sure the VPC endpoint policy allows the necessary SES actions, such as "ses:SendRawEmail" and "ses:SendEmail".
-
Check the AWS Batch job IAM role:
- Confirm that the IAM role associated with your AWS Batch job has the necessary permissions to use SES, including "ses:SendRawEmail" and "ses:SendEmail" actions.
-
Verify DNS settings:
- Ensure that DNS hostnames and DNS resolution are enabled for your VPC.
-
Use the correct endpoint:
- When using a VPC endpoint, you may need to use a different endpoint URL. Instead of "email-smtp.ap-south-1.amazonaws.com", try using the VPC endpoint DNS name, which should look something like "vpce-xxxxxxxx.email-smtp.ap-south-1.vpce.amazonaws.com".
-
Implement retry logic:
- Consider implementing an exponential backoff retry strategy in your code to handle transient network issues.
-
Check for MTU issues:
- In some cases, MTU (Maximum Transmission Unit) size mismatches can cause connectivity problems. You might need to adjust the MTU size on your network interfaces.
-
Test connectivity:
- If possible, try running a simple connectivity test from within your AWS Batch environment to the SES SMTP endpoint using tools like telnet or openssl.
-
Consider using the SES API instead of SMTP:
- If the SMTP interface continues to cause issues, you might want to switch to using the SES API directly, which could potentially bypass some of the networking complexities.
If after trying these steps you're still experiencing issues, it may be worth reaching out to AWS Support for further assistance, as they can provide more detailed, account-specific troubleshooting.
Sources
Issue sending emails from private subnet to SES through a VPC Endpoint on AWS Batch Job using Fargate | AWS re:Post
sending email from lambda function within private subnet in vpc | AWS re:Post
Amazon SES SMTP issues - Amazon Simple Email Service
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 7 months ago
