<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Raymondafuye on Medium]]></title>
        <description><![CDATA[Stories by Raymondafuye on Medium]]></description>
        <link>https://medium.com/@raymondafuye?source=rss-a3d1f275b3f2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*tnKXFJOD__1AP4zD</url>
            <title>Stories by Raymondafuye on Medium</title>
            <link>https://medium.com/@raymondafuye?source=rss-a3d1f275b3f2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 13:21:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@raymondafuye/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Aurora Standard vs I/O-Optimized]]></title>
            <link>https://medium.com/@raymondafuye/aurora-standard-vs-i-o-optimized-05bfda28c516?source=rss-a3d1f275b3f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/05bfda28c516</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Raymondafuye]]></dc:creator>
            <pubDate>Sun, 09 Aug 2026 22:05:33 GMT</pubDate>
            <atom:updated>2026-08-09T22:23:54.638Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A real bill, before and after</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CNNbbaE-C2weCz0sT_b6CA.png" /></figure><h3>Introduction</h3><p>A few months ago I looked at my Amazon Aurora Serverless v2 bill and didn’t love what I saw. The workload hadn’t changed same application, same traffic pattern, same queries. What changed was one setting: I moved the cluster’s storage configuration from Aurora Standard to Aurora I/O-Optimized.</p><p>The result showed up directly in Cost Explorer. Below are two daily cost breakdowns pulled from my own AWS account, a few months apart, for the same Aurora Serverless v2 workload.</p><h3>Before: Aurora Standard</h3><p>Daily cost breakdown from Cost Explorer that day:</p><p>● Aurora:ServerlessV2Usage = $12.83</p><p>● Aurora:StorageIOUsage = $3.73</p><p>● EUW2-NatGateway-Hours = $3.60</p><p>● QS-User-Enterprise-Month = $3.43</p><p>● Other smaller line items (CloudWatch, Fargate, VendedLog, etc.) remainder</p><p><strong>Total daily cost: </strong>$38.10</p><h3>After : Aurora I/O-Optimized</h3><p>Daily cost breakdown from Cost Explorer after switching storage type:</p><p>● Aurora:ServerlessV2IOOptimizedUsage = $12.68</p><p>● EUW2-NatGateway-Hours = $3.60</p><p>● EUW2-Fargate-vCPU-Hours:perCPU = $2.23</p><p>● EUW2-OnDemand-StreamHour = $2.30</p><p>● Other smaller line items remainder</p><p><strong>Total daily cost: </strong>$22.67</p><p>Notice there’s no separate storage I/O line item anymore that charge is now baked into the I/O-Optimized storage rate instead of being billed per request.</p><p>Same workload, roughly 40% lower daily cost. The compute charge (ServerlessV2Usage) barely moved the savings came almost entirely from how storage I/O is billed.</p><h3>What Actually Changed</h3><p>Aurora gives you two storage configurations at cluster creation (or via a modification):</p><p><strong>Aurora Standard : </strong>You pay for storage per GB, and separately for every I/O request (read or write) against that storage. Cost-effective when I/O is light.</p><p><strong>Aurora I/O-Optimized : </strong>You pay a higher per-GB storage rate, but all I/O is included at no extra charge. Cost-effective when I/O is heavy, because the per-request charges under Standard would have added up to more than the storage premium.</p><p>AWS’s own guidance is that I/O-Optimized tends to win once I/O costs pass roughly 25% of your total Aurora spend which is exactly the pattern visible in the breakdown above, where Nat Gateway, StorageIOUsage, and other I/O-adjacent charges were stacking up alongside compute.</p><h3>Understanding the Real Calculator</h3><p>To check this for your own workload rather than trust the numbers in this article use the <a href="https://cloudburn.io/tools/amazon-aurora-pricing-calculator">Aurora Pricing Calculator from CloudBurn</a>. It pulls live rates from AWS’s public pricing API, breaks Instance-based, Serverless v2, and DSQL out separately, and lets you toggle Aurora Standard against I/O-Optimized side by side for your exact region and engine.</p><p>Here’s what each input on that calculator actually controls</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*jnSr7oKwr-ioH7lZQTJdMQ.png" /></figure><p>The two fields that decide the Standard-vs-I/O-Optimized question are Storage Size and I/O Requests. Everything else (region, engine, ACU range) affects the absolute dollar amount, but the ratio between I/O requests and storage size is what determines which storage type is cheaper.</p><h3>A Practical Calculation, Same-Workload Scenario</h3><p>Using AWS’s published Aurora rates (the same ones the calculator draws from) $0.10/GB-month storage and $0.20 per million I/O requests for Standard, versus $0.225/GB-month with unlimited I/O for I/O-Optimized here’s a worked example sized close to a real Serverless v2 workload: 100 GB of storage and 150 million I/O requests in a month.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*IiJoGpi45F4lD5KIZLjRtg.png" /></figure><p><strong>Result: </strong>Aurora I/O-Optimized saves $17.50/month on storage and I/O alone a 44% reduction for identical storage and identical traffic. That’s the same order of magnitude as the real 40% drop shown in the Cost Explorer screenshots above.</p><p>The breakeven rule of thumb: if your monthly I/O requests exceed roughly 1 million per GB of storage, I/O-Optimized is very likely to be cheaper. In this example that’s 1.5 million requests per GB comfortably past the threshold, and it lines up with what actually happened on the account.</p><h3>How to Check Your Own Numbers</h3><p>● Pull your current storage size and monthly I/O request count from Cost Explorer or CloudWatch (VolumeReadIOPs / VolumeWriteIOPs).</p><p>● Plug them into the calculator’s Storage Size and I/O Requests fields.</p><p>● Toggle Storage Type between Aurora Standard and Aurora I/O-Optimized and compare the totals.</p><p>● If I/O-Optimized comes out cheaper, you can switch on an existing cluster with a storage configuration modification no downtime, no data migration required.</p><h3>Takeaway</h3><p>Aurora’s compute pricing gets most of the attention, but for I/O-heavy workloads, the storage configuration is where the real money sits. A single setting change Standard to I/O-Optimized cut this workload’s daily bill by roughly 40% with zero changes to the application, the schema, or the traffic it served.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05bfda28c516" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Partition or Pay]]></title>
            <link>https://medium.com/@raymondafuye/partition-or-pay-76da46589659?source=rss-a3d1f275b3f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/76da46589659</guid>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Raymondafuye]]></dc:creator>
            <pubDate>Mon, 03 Aug 2026 17:53:02 GMT</pubDate>
            <atom:updated>2026-08-03T18:07:37.034Z</atom:updated>
            <content:encoded><![CDATA[<p>Designing an S3 Data Lake That Doesn’t Break the Bank</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hjnGLMwzy7LfoJRMR0ZVHQ.jpeg" /><figcaption>Fig 1. Partition or Pay</figcaption></figure><p><strong>Introduction</strong><br>Every data team eventually hits the same wall: queries that used to take seconds start taking minutes, monthly Athena bills creep up without warning, and nobody can quite explain why. Nine times out of ten, the culprit isn&#39;t the query engine it&#39;s the path.</p><p><strong>The Architecture, at a Glance</strong><br>The flow is simple by design:<br><strong>S3 → Glue Crawlers → Glue Data Catalog → Athena</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MQ9gttcJUnm79ufwsIx1xw.jpeg" /><figcaption>Fig 2. Architectural Diagram</figcaption></figure><p>Data stays in place in S3 only metadata moves through the Data Catalog, so queries stay fast and cheap.<br><em> - S3 holds the raw data the actual files.<br> - Glue Crawlers scan that data, infer the schema, and detect partitions from the folder structure.<br> - Glue Data Catalog stores that schema as metadata table names, columns, types, and partition keys without ever moving or duplicating the data itself.<br> - Athena queries the data directly where it lives in S3, using the catalog as its map.</em><br>Nothing here requires standing up a database or loading data anywhere new. That&#39;s the appeal of a data lake: the data stays put in S3, and everything else is just metadata pointing at it.</p><p><strong>Why the S3 Path Is the Real Decision</strong><br>This is the part that&#39;s easy to skip and expensive to ignore. Consider a bucket structured like this:<br>ray-data-lake/diary-products/year=2026/month=june/day=01/ ray-data-lake/diary-products/year=2026/month=june/day=02/</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AfQYAMISIgDgEQCFHgADkA.jpeg" /><figcaption>Fig 3. S3 Datalake Path</figcaption></figure><p>That key=value naming convention (year=2026, month=june, day=01) isn&#39;t cosmetic. It&#39;s Hive-style partitioning, and Glue and Athena both recognize it automatically. Once a crawler picks it up, Athena can skip straight to the relevant folders for a query instead of scanning the whole dataset.<br>The difference in practice:<br> 1. No partitioning: a query for &quot;June&#39;s data&quot; scans every file in the bucket, across every month and year you&#39;ve ever loaded.<br> 2. Partitioned by year/month/day: the same query scans only the month=june/ folders often a fraction of the data, and a fraction of the cost.</p><p>Since Athena bills per byte scanned, this single design choice is usually the biggest cost lever in the entire pipeline bigger than query tuning, bigger than file format, bigger than compression. Get the path right, and everything downstream gets cheaper and faster by default.</p><p><strong>Turning Raw Files Into a Queryable Table</strong><br>Once the S3 path is in place, AWS Glue does the rest of the heavy lifting. A Glue Crawler points at the bucket location, reads the folder structure and file contents, and registers a table in the Glue Data Catalog complete with the partition keys it detected.<br>In this setup, that produces a single table, ray_data_lake, registered under the ray-crawler-database in the Data Catalog, with its source location pointing back to s3://ray-data-lake/... and its files recognized as CSV. The crawler doesn&#39;t copy the data it just builds the map.</p><p>From there, the data is queryable immediately:<br>SELECT * FROM &quot;AwsDataCatalog&quot;.&quot;ray-crawler-database&quot;.&quot;ray_data_lake&quot; LIMIT 10;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rqMYj_DMKrGu9eZVDz4fTw.jpeg" /><figcaption>Fig 4. Athena Query.</figcaption></figure><p>No ingestion job, no separate database to maintain. The Data Catalog is the bridge that lets Athena treat a folder of CSVs in S3 as if it were a proper SQL table and because the partitioning was done correctly at the path level, that query only touches the data it needs to.</p><p><strong>Why This Matters for the Data Team</strong><br>For teams that need quick, ad hoc access to data analysts running exploratory queries, dashboards refreshing on a schedule, engineers debugging a specific day&#39;s records this setup delivers two things at once:<br><strong>1. Speed. </strong>Partition pruning means queries return faster because they&#39;re not wading through irrelevant data.<br><strong>2. Cost control. </strong>Less data scanned means a smaller Athena bill, every single time the table is queried.<br>Both of these come from the same root decision: a thoughtful S3 path, defined before the data lands, not patched in after the fact. Re-partitioning a data lake after the fact is possible, but it means re-organizing potentially terabytes of existing files far more costly than doing it right from the first upload.</p><p><strong>The Takeaway</strong><br>A data lake isn&#39;t just &quot;put your files in S3 and add a query engine on top.&quot; The real architecture decision is the path itself. Structure it with clear, Hive-style partitions, let Glue Crawlers catalog it automatically, and Athena will reward you with queries that are both fast and cheap. Skip that step, and you&#39;re not really running a data lake you&#39;re running a very expensive folder.<br><strong>Partition thoughtfully, or pay for every query that has to look everywhere else instead.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76da46589659" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RDS PostgreSQL Performance Optimization Through Shared_Buffers Parameter Tuning]]></title>
            <link>https://medium.com/@raymondafuye/rds-postgresql-performance-optimization-through-shared-buffers-parameter-tuning-bed8dd257f95?source=rss-a3d1f275b3f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/bed8dd257f95</guid>
            <category><![CDATA[aws-rds-postgress]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[performance-tunning]]></category>
            <dc:creator><![CDATA[Raymondafuye]]></dc:creator>
            <pubDate>Tue, 06 May 2025 21:53:00 GMT</pubDate>
            <atom:updated>2025-05-06T21:53:00.525Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction to Performance Optimization</strong></p><p>PostgreSQL performance optimization involves enhancing the responsiveness, speed, and efficiency of the database to handle complex queries and large datasets. This can be achieved through several techniques, including SQL query optimization, hardware resource tuning, and adjusting configuration parameters such as shared_buffers, wal_buffers, maintenance_work_mem, and others.</p><p>One key area for performance tuning in Amazon RDS for PostgreSQL is accurately determining the optimal values for configuration parameters — especially shared_buffers. Proper configuration of this setting can significantly reduce disk I/O by keeping frequently accessed data in memory. However, over-allocating memory to shared_buffers can cause memory pressure and degrade overall system performance. AWS recommends monitoring disk I/O, memory usage, and database load to find the optimal configuration.</p><p><strong>What is shared_buffers in RDS PostgreSQL Architecture?</strong></p><p>The shared_buffers parameter defines how much memory PostgreSQL uses for caching table and index data. By storing this data in memory, PostgreSQL minimizes disk I/O, leading to faster query performance.</p><p>In PostgreSQL’s global memory architecture, shared_buffers are one of the major components, alongside wal_buffers and CLOG buffers. Modified data in memory, known as “dirty pages,” are periodically flushed to disk by a background writer process. This ensures that memory space remains available for new data and that data is written to permanent storage. Checkpoints are also issued automatically to flush all dirty pages, creating restore points in case of system failure.</p><p>In contrast to standard PostgreSQL, Amazon Aurora PostgreSQL leverages a log-based recovery system and does not rely on checkpoints for crash recovery. This architectural difference impacts how memory buffers are managed and how much memory is allocated to shared_buffers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*9GxhZRAeOOSUFOWRjANJiw.png" /><figcaption>Fig1. Postgresql Architecture</figcaption></figure><p><strong>Recommended Percentage for Shared_Buffers</strong></p><p>For Amazon RDS for PostgreSQL, the shared_buffers default is calculated using:</p><p>DBinstanceClassMemory/32768</p><p>Typically, it is recommended to allocate 25–35% of total RAM to shared_buffers. This value works well because PostgreSQL relies heavily on the operating system’s page cache for additional caching.</p><p>For Amazon Aurora PostgreSQL, the calculation differs because Aurora does not depend on the OS page cache. The default value is derived from:</p><p>SUM(DBInstanceClassMemory / 12038, -50003)</p><p>This results in a higher allocation, generally above 50% of total RAM.</p><p><strong>When Should You Increase Shared_Buffers?</strong></p><p>You may consider increasing shared_buffers when:</p><ul><li>You observe high disk I/O due to frequent data reads.</li><li>Query response times are slow despite efficient queries.</li><li>You are working with large datasets that are accessed frequently.</li><li>The database instance has unused memory that can be reallocated</li></ul><p>However, excessive allocation may lead to memory pressure, increased risk of swapping, and degraded performance. It’s important to test adjustments in a staging environment and monitor the impact using performance metrics.</p><p><strong>How to Calculate the Shared_Buffers Value?</strong></p><p>The value of shared_buffers is specified in 8 KB blocks. Use the following formula:</p><p>shared_buffers = (TargetPercentage x TotalRAMinGB x 1024 x 1024) / (100 x 8)</p><p><strong>Example 1: Setting 35% of RAM on a 256 GB Instance</strong></p><p>shared_buffers = (35 x 256 x 1024 x 1024) / (100 x 8)</p><p>= 11,744,051.2 (in 8 KB blocks)</p><p><strong>Alternative Byte-Based Formula</strong></p><p>For RDS PostgreSQL (using default formula):</p><p>shared_buffers = (256 x 1024 x 1024 x 1024) / 32768</p><p>= 8,388,608 bytes</p><p>Or to allocate 25% of total RAM:</p><p>shared_buffers = (25 x 256 x 1024 x 1024 x 1024) / (100 x 8)</p><p>= 8,388,608 bytes</p><p><strong>How to Modify Shared_Buffers in Amazon RDS</strong></p><ol><li>Login to the Amazon RDS console</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*aZOMY3OWxZH-Z9EniVKKnA.png" /></figure><p>2. Navigate to the database through left panel</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*gFTIiWZ70HH8jXDLDnPu7Q.png" /></figure><p>3. Select your database instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*aZOMY3OWxZH-Z9EniVKKnA.png" /></figure><p>4. Under configuration details, find and click the linked Parameter Group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*8wW_QyQ9lHjasmqrSXjAFw.png" /></figure><p>5. In the Modifiable Parameters section, search for shared_buffers</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*J9GWZFa9BgBjPBB8e9OqDA.png" /></figure><p>6. Modify the value using your calculated result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*kTsa_2v25pIxzT8UpfXfXA.png" /></figure><p>7. Save changes.</p><p>8. Reboot the instance for the new value to take effect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*jaLNn86v8GzNIdOEQDQd6A.png" /></figure><p>Note: shared_buffers is a static parameter, and changes require a database reboot.</p><p>Benefits of Tuning Shared_Buffers</p><p><strong>Proper tuning of shared_buffers can lead to:</strong></p><ul><li>Reduced Disk I/O: Frequently accessed data is served from memory instead of slower disk.</li><li>Faster Query Performance: Queries respond faster due to reduced latency.</li><li>Better Resource Utilization: Balanced memory usage leads to more efficient workloads.</li><li>Improved Concurrency: Multiple users and queries can be handled smoothly.</li></ul><p>PostgreSQL uses a Least Recently Used (LRU) algorithm to evict older cache entries, maintaining optimal cache freshness and efficiency.</p><p>However, if shared_buffers is too small, the system may rely more on disk, leading to slower performance. If it’s too large, it may compete with other system processes for memory, potentially causing swapping and instability.</p><p>Conclusion</p><p>Tuning the shared_buffers parameter is a critical step in optimizing the performance of PostgreSQL databases on Amazon RDS. By understanding how shared memory works and calculating an appropriate buffer size based on your workload and instance size, you can reduce disk I/O, improve query performance, and ensure efficient memory utilization.</p><p>However, tuning must be done thoughtfully. It’s essential to monitor performance metrics, test changes in a non-production environment, and apply adjustments incrementally. With the right balance, shared_buffers can significantly contribute to achieving a robust, high-performing PostgreSQL database environment on AWS.</p><p>References</p><p>1. Amazon Web Services. “Working With Parameters on Your RDS for PostgreSQL DB Instance.” Retrieved from: <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.Parameters.html">https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.Parameters.html</a></p><p>2. <em>Kiran Singh</em>. (2023, November 8). Amazon Web Services. <a href="https://aws.amazon.com/blogs/database/determining-the-optimal-value-for-shared_buffers-using-the-pg_buffercache-extension-in-postgresql/">https://aws.amazon.com/blogs/database/determining-the-optimal-value-for-shared_buffers-using-the-pg_buffercache-extension-in-postgresql/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bed8dd257f95" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IoT Data Logging: A Scalable Cloud-Based Solution]]></title>
            <link>https://medium.com/@raymondafuye/smart-meter-data-logging-a-scalable-cloud-based-solution-8f028c69fe06?source=rss-a3d1f275b3f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f028c69fe06</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[datalogging]]></category>
            <dc:creator><![CDATA[Raymondafuye]]></dc:creator>
            <pubDate>Mon, 24 Mar 2025 13:18:57 GMT</pubDate>
            <atom:updated>2025-04-03T11:40:25.111Z</atom:updated>
            <content:encoded><![CDATA[<h3>Overview</h3><p>In this article, we explore a robust data logging architecture for IoT, leveraging cloud services to enable efficient ingestion, storage, and processing of meter data. The solution integrates FTP, AWS Lambda, S3, and PostgreSQL RDS to automate the flow of data from meters to a structured database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*DvDK-tNTqoxYN0-EcTVHJw.png" /></figure><h3>System Architecture</h3><p>The data pipeline follows these key steps:</p><ol><li><strong>IoT Device</strong>: Generates consumption data and transmits it via FTP.</li><li><strong>Remote Server (cPanel or Equivalent Storage)</strong>: A temporary storage location for incoming meter data.</li><li><strong>AWS Lambda (FTP to S3)</strong>: Periodically retrieves files from the FTP server, uploads them to S3, and removes them from the FTP server upon successful transfer.</li><li><strong>Amazon S3</strong>: Acts as a storage bucket for raw meter data.</li><li><strong>AWS Lambda (S3 to RDS)</strong>: Processes CSV files, extracts metadata, and inserts structured data into an RDS PostgreSQL database.</li><li><strong>Amazon RDS (PostgreSQL)</strong>: Stores processed meter readings for analytics and reporting.</li></ol><h3>Data Flow and Components</h3><h3>FTP Setup and Data Transfer</h3><p>Smart meters push data files to a remote FTP server, acting as an intermediary storage layer. A cloud-based function continuously monitors this directory, retrieves new files, and uploads them to S3 for further processing.</p><h3>AWS Lambda: FTP to S3 Upload</h3><p>A Lambda function automates file transfers, ensuring:</p><ul><li>Secure retrieval of new files from the FTP server.</li><li>Storage of these files in an S3 bucket.</li><li>Deletion of successfully transferred files from the FTP server.</li><li>Prevention of duplicate uploads by checking for existing files in S3.</li></ul><h3>AWS S3 Bucket</h3><ul><li>Provides scalable, secure, and cost-effective storage for incoming meter data.</li><li>Triggers the second Lambda function upon file upload.</li></ul><h3>AWS Lambda: S3 to RDS Processing</h3><p>Once a file lands in S3, a second Lambda function processes it:</p><ol><li><strong>Triggered by S3 Upload</strong>: Initiates data extraction upon file arrival.</li><li><strong>Extracts Metadata</strong>: Retrieves meter details from the filename using regex.</li><li><strong>Reads CSV File</strong>: Loads data into a Pandas DataFrame.</li><li><strong>Timestamp Adjustment</strong>: Converts time zones for accurate reporting.</li><li><strong>Data Processing</strong>:</li></ol><ul><li>Maps columns to database schema.</li><li>Enriches data with additional metadata (timestamp, device ID, location, etc.)</li><li>Logs missing columns for debugging.</li></ul><p><strong>6. Data Insertion into PostgreSQL RDS</strong>:</p><ul><li>Uses batch processing for optimized performance.</li><li>Prevents duplicate entries with ON CONFLICT (timestamp) DO NOTHING.</li><li>Logs successful and failed insertions.</li></ul><h3>PostgreSQL RDS Database</h3><ul><li>Serves as the final destination for processed data.</li><li>Maintains structured smart meter readings.</li><li>Supports analytical queries and reporting.</li></ul><h3>Why This Approach?</h3><p>This cloud-based approach ensures:</p><ul><li><strong>Automation</strong>: No manual intervention needed for file transfers and processing.</li><li><strong>Scalability</strong>: AWS services handle varying loads efficiently.</li><li><strong>Data Integrity</strong>: Eliminates duplicate uploads and prevents conflicts in storage.</li><li><strong>Cost Optimization</strong>: Serverless functions and S3 storage reduce infrastructure costs.</li></ul><h3>Conclusion</h3><p>With this architecture, smart meter data is reliably logged, stored, and processed using cloud-native services. The combination of FTP, AWS Lambda, S3, and PostgreSQL RDS provides a scalable and efficient solution for real-time energy consumption monitoring. By automating ingestion and processing, organizations can enhance data accuracy and streamline analytics workflows.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f028c69fe06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Alert Solution with AWS CloudWatch Alarm, SNS, Lambda, and SES]]></title>
            <link>https://medium.com/@raymondafuye/alert-solution-with-aws-cloudwatch-alarm-sns-lambda-and-ses-66cb6e1616c4?source=rss-a3d1f275b3f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/66cb6e1616c4</guid>
            <dc:creator><![CDATA[Raymondafuye]]></dc:creator>
            <pubDate>Tue, 28 Jan 2025 16:05:07 GMT</pubDate>
            <atom:updated>2025-01-28T16:05:07.557Z</atom:updated>
            <content:encoded><![CDATA[<p>Alerting is a critical aspect of monitoring in any infrastructure, enabling proactive responses to system anomalies and ensuring minimal downtime. AWS provides a powerful and integrated solution for generating, customizing, and delivering alerts using services like CloudWatch Alarm, Simple Notification Service (SNS), Lambda, and Simple Email Service (SES). This document outlines how these components work together to deliver customized and user-friendly alerts to clients at different frequencies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*4iz6C8vZcM2FNe8n8IxMwQ.png" /></figure><p><strong>AWS Resources and Their Roles in the Solution</strong></p><p><strong>1. Amazon CloudWatch</strong></p><p><strong>Purpose:</strong> Monitors metrics and generates alarms when thresholds are breached.<br> CloudWatch provides near real-time monitoring of resources and applications deployed in AWS. It collects and analyzes logs, metrics, and events to detect anomalies and trigger actions. In this solution, CloudWatch Alarms are configured to monitor specific metrics and alert stakeholders when predefined thresholds are crossed.</p><p><strong>Key Features Used:</strong></p><ul><li><strong>Metrics Collection:</strong> Monitors metrics like voltage, latency, or CPU utilization.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*UpxWN2jZfX-1vclmR3_F8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*zgLR7d4TOaJRKCIX9Vo8qA.png" /></figure><ul><li><strong>Alarm Configuration:</strong> Sets thresholds that, when breached, trigger actions like notifying stakeholders.</li></ul><p><strong>2. Amazon SNS (Simple Notification Service)</strong></p><p><strong>Purpose:</strong> Manages message delivery for alerts.<br> SNS acts as the message broker in this solution. When a CloudWatch Alarm is triggered, it sends notifications to an SNS topic. SNS ensures that the alert reaches multiple endpoints, including email addresses, Lambda functions, or mobile devices.</p><p><strong>Key Features Used:</strong></p><ul><li><strong>Topic Creation:</strong> Organizes and routes messages.</li><li><strong>Subscriptions:</strong> Allows endpoints like email or Lambda to receive messages.</li></ul><p><strong>3. AWS Lambda</strong></p><p><strong>Purpose:</strong> Customizes alert messages for better readability and client-specific needs.<br> A Lambda function processes raw alarm messages received via SNS. It reformats these messages into a user-friendly format tailored for clients, ensuring clarity and actionable insights. Lambda also enables dynamic customization of alerts based on different conditions or thresholds.</p><p><strong>Key Features Used:</strong></p><ul><li><strong>Event-Driven Execution:</strong> Triggered by SNS messages.</li><li><strong>Integration with SES:</strong> Sends customized emails to clients.</li></ul><p><strong>4. Amazon SES (Simple Email Service)</strong></p><p><strong>Purpose:</strong> Sends bulk, customized alert emails to clients.<br> SES handles the delivery of processed alerts to clients. It supports sending high volumes of emails with customizable templates, ensuring timely and reliable delivery of critical information.</p><p><strong>Key Features Used:</strong></p><ul><li><strong>Bulk Emailing:</strong> Notifies multiple clients simultaneously.</li><li><strong>Custom Templates:</strong> Enhances the readability and effectiveness of alert emails.</li></ul><p><strong>Integration Workflow</strong></p><p>The architecture integrates the above resources in a seamless workflow:</p><ol><li><strong>Metric Monitoring:</strong> CloudWatch monitors a specific metric (e.g., voltage unbalance) and triggers an alarm when the threshold is breached.</li><li><strong>SNS Notification:</strong> The alarm sends a notification to the configured SNS topic.</li><li><strong>Message Customization:</strong> The SNS topic invokes a Lambda function that processes and customizes the alarm message.</li><li><strong>Email Delivery:</strong> Lambda uses SES to send the processed message to a bulk list of client emails.</li></ol><p>This solution ensures that alerts are not only accurate but also clear and actionable for stakeholders.</p><p><strong>Alert Frequencies and Customization</strong></p><ul><li><strong>Real-Time Alerts:</strong> CloudWatch can trigger alarms immediately when thresholds are breached.</li><li><strong>Batch Notifications:</strong> Lambda and SES can be configured to send periodic summaries instead of real-time alerts for non-critical metrics.</li><li><strong>Dynamic Customization:</strong> The Lambda function can differentiate alert levels (e.g., critical, warning) and customize the frequency and content accordingly.</li></ul><p><strong>Conclusion</strong></p><p>By combining AWS CloudWatch, SNS, Lambda, and SES, this solution delivers a scalable, efficient, and user-friendly alerting mechanism. It ensures stakeholders receive timely and actionable notifications, minimizing response times and improving overall system reliability. This architecture highlights the flexibility and power of AWS services in addressing critical operational challenges.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66cb6e1616c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>