AWS Builder Center
Weekend Annoying Task Challenge: Certificate-on-Demand

Weekend Annoying Task Challenge: Certificate-on-Demand

Learn how I built a serverless certificate generation system on AWS that automatically creates, securely delivers, and cleans up event certificates on demand while reducing operational costs.

Backend-focused Full Stack Developer | AWS Serverless & Cloud | Technical Writer

Introduction

One of the most repetitive and time-consuming tasks after every student event is distributing participation certificates. As our community grew, manually generating and sending hundreds of certificates became increasingly difficult.
Our previous workflow had several limitations:
  • Gmail SMTP imposed daily sending limits and required someone to keep a laptop running until all 200-300 certificate emails were delivered.
  • Google Apps Script required storing every generated certificate in Google Drive, resulting in unnecessary long-term storage.
  • Traditional mailing APIs still required certificate generation to run on our own infrastructure, consuming compute resources and Cloudflare Workers quota.
  • Bulk email delivery increased the chances of delays and spam filtering.
Instead of trying to optimize these limitations, I decided to automate the entire process with a serverless application on AWS that generates certificates only when they are requested.



Vision & What the App Does

The goal of this application is simple: eliminate the repetitive task of manually generating, storing, and distributing certificates.
Instead of permanently storing thousands of PDF files, the application treats certificates as generated artifacts.
Whenever a participant requests a certificate:
  • The application checks whether it already exists.
  • If available, it immediately provides a secure download link.
  • Otherwise, it regenerates the certificate using stored participant metadata.
  • The generated PDF is stored temporarily.
  • Amazon S3 Lifecycle Rules automatically remove temporary files after the configured retention period.
This approach keeps operational costs low while ensuring certificates remain available whenever users need them.



How I Built It

The application follows a lightweight serverless architecture using fully managed AWS services.
A request begins at Amazon API Gateway, which invokes an AWS Lambda function.
Lambda first checks whether the requested certificate already exists in Amazon S3.
If the certificate exists:
  • Lambda generates a temporary Amazon S3 pre-signed URL.
  • The user downloads the certificate immediately.
If the certificate does not exist:
  • Lambda regenerates the certificate from participant metadata.
  • The generated PDF is uploaded to Amazon S3.
  • A pre-signed download URL is returned to the user.
  • Amazon S3 Lifecycle Rules automatically remove the generated file after the retention period.
One of the biggest design decisions was storing only the source data instead of every generated certificate. Since certificates can always be recreated, permanent storage isn't necessary.



AWS Services Used & Architecture Overview

The application uses the following AWS services:
  • Amazon API Gateway: Receives certificate requests.
  • AWS Lambda: Handles certificate generation and business logic.
  • Amazon S3: Securely stores generated certificates.
  • Amazon S3 pre-signed URLs: Allows temporary secure downloads.
  • Amazon S3 Lifecycle Rules: Automatically deletes regenerated certificates after a retention period.
The request flow is straightforward:
  1. User requests a certificate.
  1. API Gateway triggers AWS Lambda.
  1. Lambda checks Amazon S3.
  1. If the certificate exists, a pre-signed URL is returned.
  1. Otherwise, Lambda generates the certificate, uploads it to Amazon S3, and returns a secure download link.
  1. Amazon S3 Lifecycle Rules automatically remove temporary files after the configured period.
High-level architecture of the serverless certificate generation workflow. AWS Lambda checks whether a certificate already exists in Amazon S3. If available, it generates a pre-signed URL for secure access. Otherwise, the certificate is regenerated, uploaded to Amazon S3, and served to the user. An Amazon S3 Lifecycle Rule automatically removes regenerated certificates after the configured retention period.




Why I Chose AWS Lambda

Certificate generation is highly unpredictable.
Immediately after an event, hundreds of participants may request certificates simultaneously. On other days, there may be no requests at all.
AWS Lambda was the ideal service because it:
  • Eliminates server management.
  • Automatically scales with demand.
  • Charges only when code executes.
  • Integrates seamlessly with other AWS services.
This means there is no need to keep compute resources running when nobody is requesting certificates.



Why Amazon S3

Certificates are simply PDF documents.
Amazon S3 provides:
  • Durable object storage.
  • High scalability.
  • Low storage costs.
  • Fine-grained IAM permissions.
Instead of exposing the bucket publicly, users receive temporary pre-signed URLs that expire automatically.



Cost Optimization

Since this project was designed for a student community, keeping cloud costs low was a major priority.
The application minimizes costs by:
  • Running AWS Lambda only when certificates are requested.
  • Storing generated certificates only temporarily.
  • Automatically cleaning up files using Amazon S3 Lifecycle Rules.
  • Regenerating certificates whenever necessary instead of storing thousands permanently.
This significantly reduces storage costs while maintaining a reliable user experience.



Security Considerations

The application follows several security best practices:
  • Amazon S3 buckets remain private.
  • IAM roles follow the principle of least privilege.
  • Downloads are delivered through temporary pre-signed URLs.
  • Generated certificates are automatically deleted after the retention period.
By reducing how long certificates remain in storage, the application also minimizes unnecessary exposure of sensitive documents.



What I Learned

Building this application reinforced several architectural principles.
I learned that generated files don't always need to be stored permanently if they can be recreated from source data.
I also gained a deeper understanding of how AWS Lambda enables event-driven architectures that scale automatically without managing servers.
Finally, I realized that combining AWS Lambda with Amazon S3 Lifecycle Rules creates a simple yet effective pattern for reducing storage costs while maintaining a secure and scalable application.



Link to App or Repository

This project is open source and available on GitHub.
The repository contains the source code, project structure, and AWS implementation used for this serverless certificate generation system.



Conclusion

This project transformed one of our most repetitive operational tasks into an automated serverless workflow.
Instead of relying on laptops, SMTP servers, or long-running processes, certificates are now generated on demand, securely delivered using Amazon S3 pre-signed URLs, and automatically removed when they are no longer needed.
The result is a scalable, secure, and cost-effective solution that significantly reduces manual effort while improving the overall experience for both organizers and participants.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article