This repository provides a solution for implementing a serverless architecture on AWS to track inventory levels across stores worldwide. The system allows stores to upload inventory files to an Amazon S3 bucket, triggering a series of serverless processes. The architecture includes Lambda functions, DynamoDB for data storage, Amazon Cognito for authentication, and Amazon SNS for notifications.
-
Upload Inventory File to S3:
- Upload an inventory file to an Amazon S3 bucket.
-
Process Inventory File:
- Trigger a Lambda function to read the uploaded file and insert items into a DynamoDB table.
-
Dashboard Application:
- Develop a serverless, web-based dashboard using Amazon Cognito for authentication.
- Display inventory levels from the DynamoDB table.
-
Notification System:
- Implement a Lambda function to receive updates from the DynamoDB table.
- Send a message to an SNS topic when an inventory item is out of stock.
- Receive notifications through SMS or email.
Traditionally, applications run on servers, requiring management and provisioning. This solution leverages AWS Lambda, eliminating the need for pre-allocated servers. The code runs on-demand, scaling automatically and incurring costs only when in use.
- Navigate to the Lambda service on the AWS Management Console.
- Create a new Lambda function named Load-Inventory using the Python 3.7 runtime.
- Configure the function to use an existing role named Lambda-Load-Inventory-Role.
- Copy and paste the provided Python code (
lambda_function.py
) into the code editor. - Deploy the function.
- Navigate to the S3 service on the AWS Management Console.
- Create a unique bucket, e.g., inventory-123.
- Configure the bucket to trigger the Load-Inventory Lambda function on object creation.
- Download inventory files for testing.
- Upload a file to the S3 bucket and verify successful data loading.
- Navigate to the Simple Notification Service (SNS) on the AWS Management Console.
- Create a topic named NoStock for inventory alerts.
- Subscribe to the topic via email for notifications.
- Create a new Lambda function named Check-Stock using Python 3.7 runtime.
- Configure the function to use an existing role named Lambda-Check-Stock-Role.
- Copy and paste the provided Python code (
lambda_function.py
) into the code editor. - Deploy the function and add a trigger for DynamoDB on the Inventory table.
- Upload a different inventory file to S3.
- Verify the Inventory System Dashboard for updated data.
- Receive a notification via SMS or email for any out-of-stock items.
This lab demonstrates the implementation of a serverless architecture on AWS for efficient inventory tracking. The solution is scalable, cost-effective, and provides real-time notifications for inventory management.