The AWS Raffles System is a serverless application designed to manage raffle entries and draw winners. This project leverages various AWS services to create a scalable, secure, and efficient system.
- Simple HTML and CSS Page: A user-friendly interface for participants to enter the raffle.
- DynamoDB Table: Stores raffle entries with participant details.
- Lambda Function: Handles backend logic for processing entries and drawing winners.
- API Gateway: Exposes APIs for the frontend to interact with the backend services.
- Mutual TLS Authentication: Ensures secure communication between clients and the API Gateway.
- Hosting on S3 and CloudFront: Serves the HTML page with low latency and high availability.
This project automates 90% of the setup steps, including:
- DynamoDB Table Creation: Automatically creates the DynamoDB table with the required attributes.
- Lambda Functions Deployment: Deploys the necessary Lambda functions for handling raffle entries, counting records, and drawing winners.
- API Gateway Configuration: Sets up the API Gateway with the required endpoints and mutual TLS authentication.
- SSL/TLS Certificates Generation: Automates the generation of self-signed SSL/TLS certificates using OpenSSL.
- S3 and CloudFront Setup: Configures S3 for hosting the HTML page and sets up CloudFront for global content distribution.
This automation significantly reduces the manual effort required to set up the project, allowing you to focus on customization and enhancements.
To use the project, follow these steps:
-
Install boto3:
pip install boto3
-
Install AWS CLI: Follow the instructions here to install the AWS CLI.
-
Configure AWS CLI:
aws configure
Provide your AWS access key, secret key, region, and output format when prompted.
Amazon S3: Hosts the static HTML and CSS files.
Amazon API Gateway: Manages API requests and routes them to the appropriate Lambda functions.
Amazon CloudFront: Distributes the content globally with low latency.
AWS Lambda: Executes backend logic without provisioning servers.
Amazon DynamoDB: Stores raffle entries in a NoSQL database.
AWS Certificate Manager: Manages SSL/TLS certificates for secure communication.
Amazon Route 53: Manages DNS and routes traffic to the CloudFront distribution.
-
Create DynamoDB Table:
- Use the provided script to create a DynamoDB table with the necessary attributes.
- Ensure the table has
email
as the partition key, and additional attributes forphone_number
andfull_name
.
-
Create 3 Lambda Functions:
- For adding record to DynamoDB table
- To get the count of records on the Table
- To Draw the winners
-
Create API Gateway:
- Set up API Gateway to expose the necessary endpoints for the frontend to interact with the backend.
-
Configure Mutual TLS Authentication:
- Generate SSL/TLS Certificates:
- Download and install OpenSSL from here.
- Follow these steps to generate a self-signed certificate:
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
- Provide the necessary information when prompted, such as country, state, and organization name.
- Use the generated
key.pem
andcert.pem
files for mutual TLS authentication.
- Enable Mutual TLS Authentication:
- Configure mutual TLS authentication on the API Gateway to secure communication.
- For detailed instructions, see the following documentation.
- Generate SSL/TLS Certificates:
-
Host HTML Page on S3 and CloudFront:
- Upload your HTML and CSS files to an S3 bucket.
- Set up a CloudFront distribution to serve the content globally.
Watch the project demo video below to see the AWS Raffles System in action:
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or inquiries, please contact here.