DEV Community

Girish Mukim
Girish Mukim

Posted on • Edited on

AWS Cost Estimate Tracker: Enhanced Insights with Generative AI

The AWS Pricing Calculator is an online tool provided by Amazon Web Services (AWS) that helps estimate the cost of using various AWS services. Whether you’re just starting a small project or planning a large-scale deployment, this tool gives you the ability to calculate monthly costs for a range of services, from simple EC2 instances to complex architectures using multiple AWS services.

While it's incredibly useful, the AWS Pricing Calculator has a few limitations:

Link Management: Every time you create or update an estimate, a unique link is generated. If you're working on multiple versions of the same project (like adding a production environment after initially estimating only non-production costs), you'll quickly end up with multiple links. Keeping track of these can become cumbersome.

Changing Prices: AWS service prices are not static. As AWS updates their pricing, estimates might change when you revisit a link. This can lead to confusion if you want to compare the old cost with the new prices.

Link Expiration: AWS pricing calculator links are active for up to three years. After that, you lose access to the data unless you’ve saved a copy in another format (CSV, PDF, or JSON).

AWS Cost Estimate Tracker (ACET)

Let's solve the problem of managing and tracking multiple pricing calculator links for different scenarios. This tool will help you stay organized by keeping all those links, and PDFs in one place so that you don’t have to worry about losing track of any estimate, even as you work on different projects or adjust your pricing estimates over time.

The idea is to provide a simple, efficient way to store and access past estimates, track changes, and even compare how service prices have evolved since the estimate was originally made. I'm sharing this concept as a way to help others who might be facing the same challenges. 
No conversation is complete without generative AI these days, and APCT is keeping up with the trend. My goal is to leverage AWS Bedrock to analyze estimates and deliver actionable insights and recommendations.

Features of AWS Cost Estimate Tracker (ACET)

User Management
Users will be able to sign up and manage their accounts securely using Amazon Cognito User Pools. Once logged in, you can access your personalized dashboard, where you can view and manage all the AWS Pricing Calculator links you've tracked, along with the associated information.

Track Links with Project and Version Information
Keep a detailed record of your AWS Pricing Calculator links organized by project. You can add descriptive information for each link, including version details (e.g., initial estimate, added production environment, etc.), making it easier to track different pricing scenarios over time.

Upload and Download Files
For each pricing estimate, you’ll have the ability to upload and download PDF files. This ensures you maintain a snapshot of the original pricing data even if AWS service prices change. You can reference these files later for comparison or documentation purposes, preserving the historical cost estimates for your projects.

GenAI Analysis
GenAI Analysis is another feature of the application that uses generative AI to analyze AWS estimates and provide actionable insights and recommendations. It simplifies understanding complex cost structures and helps identify optimization strategies efficiently.

Solution Architecture

Architecture

Data Flow

Building Blocks:

Webpage Hosted on S3 with Static Web Hosting Enabled
The front-end of the application is hosted on an S3 bucket with static website hosting enabled. This allows for a cost-effective and scalable way to serve the application’s HTML, CSS, JavaScript, and other static assets directly from S3.

CloudFront Distribution
To improve the performance and security of the web application, we are using Amazon CloudFront as a content delivery network (CDN). CloudFront distributes the content globally, reducing latency for users and ensuring fast load times by caching assets closer to the user's location. The origin for the CloudFront distribution is the S3 bucket where the static website is hosted.

User Management with Amazon Cognito User Pool
User authentication and management are handled through Amazon Cognito User Pools. Users can sign up, log in, and manage their accounts securely. The user pool also enables features such as multi-factor authentication (MFA), account recovery, and password management, ensuring robust security for user information. Once logged in, users can access their personalized dashboard to track and manage AWS Pricing Calculator links.

DynamoDB as a Data Store
All data related to AWS Pricing Calculator links, project versions, and associated files (CSV, PDF, JSON) are stored in an Amazon DynamoDB table. This NoSQL database provides fast, scalable, and reliable storage. Each user can store project-related data, including:

  • AWS Pricing Calculator links
  • Descriptions and versioning information
  • References to uploaded files (PDF)

DynamoDB ensures fast read/write operations and can scale automatically to handle increasing amounts of data.

Amazon Textract
Amazon Textract is utilized in this solution to extract structured text and data from uploaded PDF documents containing project estimates. It efficiently processes the content, identifying text lines, tables, and key-value pairs to extract meaningful information. This enables seamless downstream analysis.

Amazon Bedrock
In this solution, Amazon Bedrock is leveraged to analyze extracted project estimates and generate actionable insights and cost optimization recommendations. Using its advanced large language models (LLMs), Bedrock processes the structured data to identify patterns, inefficiencies, and potential savings.

This architecture provides a fully serverless solution with high performance, scalability, and security, making it a solid foundation for the prototype as it continues to evolve.

How to use this application?

  1. Have your AWS projects estimates completed using AWS Pricing calculator.
  2. Get the sharable link and download estimates in a PDF format.
  3. SignUp or SignIn into the application.
  4. Complete a simple form to add your project estimates on right section; estimates will be rendered at runtime on the left section. Any changes for the same project will add a separate entry as a new version.
  5. Download PDF files or go to calculator link from the estimates.
  6. Click on an Anazlyze button for the specific estimate to generate Generative AI analysis.

You would need to setup few resources manually and then refer this
Github Repo.

  • S3 Bucket with static web hosting. Use code from repo.
  • Cloudfront distribution with above S3 bucket as origin
  • Amazon Cognito user pool and identity pool
  • Dynamodb tables awscalcculatorhistorytracker - To track of calculator links and estimate files. Partition key: email (String) & Sort key: project_name_version (String) EstimatesAnalysis - To save GenAI analysis for future use. Partition key: project_version (String)
  • Lambda Function - code is available in repo AnalyzeEstimate.py
  • API gateway to expose the Lambda function as HTTP API.

I plan to work on an IaC Terraform template to create these resources in the future, but I’m not there yet. I’d be thrilled to collaborate with Terraform experts who are interested!

Watch this video to see the tool in action. -

Top comments (0)