Integrate Lambda with the S3 service. Start Putting an object file in s3 that contains multiple email IDs. Then utilizing the BOTO3 library, retrieve those email IDs from the file. And send to email using SES Service for each email ID.

Prashant singh
4 min readJul 2, 2023

--

Hello everyone,

In this Blog, we integrate lambda with the s3 service and then retrieve the emails and send them to a particular person using the SES service.

Before starting the Implementation, We need to understand the AWS services that are provided by Amazon which we used in this project.

  1. Amazon SES:- Amazon SES stands for Simple Email Service. Amazon SES is an email tool that also supports a variety of deployments including dedicated, shared, or owned IP addresses. Reports on sender statistics and an email deliverability dashboard help businesses make every email count.
  2. Amazon S3:- Amazon S3 is object storage built to store and retrieve any amount of data from anywhere. S3 is a simple storage service that offers industry-leading durability, availability, performance, security, and virtually unlimited scalability at very low costs.
  3. Amazon Lambda:- AWS Lambda lets you run code without provisioning or managing servers. You pay only for the computing time you consume — there is no charge when your code is not running. With Lambda, you can run code for virtually any type of application or backend service — all with zero administration. Just upload your code, and Lambda takes care of everything required to run and scale your code with high availability. You can set up your code to automatically trigger from other AWS services or call it directly from any web or mobile app.

Step-by-step Implementation:-

Step 1:- Create S3 Bucket and Amazon SES.

  • Search for the S3 and Click on Create Bucket.
  • Enter the unique Bucket name.
  • In the S3 bucket properties, Configure the event and select the desired event types like object creation or object delete.
  • Specify the lambda function you created as the target.
  • Bucket Successfully created.

Step 2:- Create SES service.

  • Search for the SES and click on Create an identity.
  • Now, enter the name and Email address to verify the identity.
  • Users get the mail to verify their identity.
  • whenever users click on the link to verify their identity to reach the aws page.
  • After successfully verified. Go to the lambda function.

Step 3:- Create Lambda Function

  • Open the Amazon console and login.
  • Search for the Lambda function and Click on the Lambda function and Create.
  • Enter the unique name of the function and select the Runtime Environment. and click on Create Function.
  • create a new execution role or choose an existing one.
  • Now, Write the code for your lambda function.
  • Change the code according to your needs.
  • Now, Configure the lambda trigger. Add S3 service in Trigger.
  • Attach the policy of S3 and SES in the role of the lambda function.
  • Now, After Uploading a text file where we store email ids in the S3 bucket.
  • Now, the Lambda function trigger and Send the mail to the user using the SES service.
  • Also, we can check the logs in the Cloudwatch.

That’s it.

Thank You.

If this post was helpful, please follow and click on the 👏 clap button below to show your support. 🙏

Follow me on Linked-in for further updates- https://www.linkedin.com/in/prashant-9925/

--

--