Integrating AWS SES, Lambda and S3 to send emails by uploading different email list in S3 bucket.

Aaryan Gupta
5 min readJul 21, 2023

--

To complete our above motive, we will use AWS multiple service likes-

  1. AWS SES: Amazon SES (Simple Email Service) stands as an AWS cloud-based email sending and receiving service. It empowers you to transmit transactional emails, marketing campaigns, and diverse high-quality content to your customers. SES offers a dependable infrastructure for email delivery and assists in preserving a positive sending reputation by managing tasks like ISP (Internet Service Provider) throttling, feedback loops, and bounce handling. Furthermore, SES supports DKIM (DomainKeys Identified Mail) and SPF (Sender Policy Framework) to authenticate your emails and mitigate the likelihood of them being flagged as spam.
  2. AWS S3: Amazon S3 (Simple Storage Service) is an exceptionally scalable and resilient object storage service delivered by AWS. With S3, you gain the ability to store and retrieve vast amounts of data from any location on the internet. S3 boasts industry-leading performance, ensuring high availability and data durability. It finds widespread usage in storing and distributing static web content, facilitating data backups, and serving as a data lake for big data analytics purposes. Additionally, S3 offers valuable features such as versioning, access control, event notifications, and lifecycle management, enabling automated data tiering for enhanced efficiency.
  3. AWS Lambda: AWS Lambda is an innovative serverless compute service offered by Amazon Web Services (AWS). This service empowers you to execute your code without the need to provision or manage servers. Lambda handles automatic scaling of your applications in response to incoming requests or events, ensuring efficient resource utilization. You can utilize Lambda to develop diverse applications, ranging from web and mobile backends to data processing pipelines and IoT (Internet of Things) applications. The service supports multiple programming languages and seamlessly integrates with other AWS services, streamlining the process of building serverless architectures.

So, let’s start………😁

Step-1 Create a S3 bucket where we’ll upload our email containing file.

Step-2 Now we will crete a Lamda function, so after we can integrate with our S3 service.

Step-3 Now go back to your bucket, which you have created in step-1.

then go to properties section, scroll down and come to Event notification, click on create event notification.

Now perform steps as shown in image below…….😃

Step-4 Now, search for AMAZON SES service, click on create identity, then select email and give your email id for verification.

After creating identity, you will receive an email on your mail, confirm that email.

After verifying, refresh SES page, now you will see verified email. In such way you can add 3–4 mails, to which you want to send mail.

step-5 Go to your lambda function page, their go to configuration tab, click on permission tab , in left corner. Then click on link (shown in image).

Now go to add permission, attach policies, search for S3 permission and SES permission. click on Add permission.

That’s it. Now again go to your lambda function code section, and copy the following code this link —

lamdafunctioncodeforSES/lambdacodeforses.py at main · aaryangupta/lamdafunctioncodeforSES (github.com)

All set, click on deploy.

Now when you upload any thing on s3, you will get mail on your email ids.

Aditional Information —

Here, our account comes under AWS SES Sandbox, so we need to verify all the email, to which we want to send notifications EMAIL. but if you want to send email without confirming whether end email is correct or not, just follow below link-

Moving out of the Amazon SES sandbox — Amazon Simple Email Service

Thanks for reading !!!!

If any issue found, or face difficulty, you can connect with me on my linkdin-

https://www.linkedin.com/in/aaryan--guptaa/

--

--