<?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 Peter Kinywa on Medium]]></title>
        <description><![CDATA[Stories by Peter Kinywa on Medium]]></description>
        <link>https://medium.com/@kinyywa?source=rss-33bd0d05bf1f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sKdMqyaZj16AwQkd5-P8Zw@2x.jpeg</url>
            <title>Stories by Peter Kinywa on Medium</title>
            <link>https://medium.com/@kinyywa?source=rss-33bd0d05bf1f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 02 Jun 2026 15:16:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kinyywa/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[30 Days DevOps Challenge — Building an NBA Data Lake on AWS]]></title>
            <link>https://medium.com/@kinyywa/building-an-nba-data-lake-on-aws-24c47582664a?source=rss-33bd0d05bf1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/24c47582664a</guid>
            <dc:creator><![CDATA[Peter Kinywa]]></dc:creator>
            <pubDate>Tue, 14 Jan 2025 19:19:36 GMT</pubDate>
            <atom:updated>2025-01-14T19:21:00.129Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>This project aims to automate the creation of a data lake for NBA analytics using AWS services. By integrating Amazon S3, AWS Glue, and Amazon Athena, we can set up the infrastructure needed to store and query NBA-related data efficiently.</p><h3>Project Overview</h3><p>The project consists of two main scripts:</p><ol><li><strong>nba_datalake.py</strong>: Running this script performs the following actions:</li></ol><ul><li>Creates an Amazon S3 bucket to store raw and processed data.</li><li>Uploads NBA data (JSON format) to the S3 bucket.</li><li>Creates an AWS Glue database and an external table for querying the data.</li><li>Configures Amazon Athena for querying data stored in the S3 bucket.</li></ul><p><strong>2. delete_resources.py</strong>: Running this script performs the following actions:</p><ul><li>Deletes the Amazon S3 bucket and its contents.</li><li>Deletes the AWS Glue database and associated tables.</li><li>Deletes Athena query results stored in the S3 bucket.</li></ul><h3>Prerequisites</h3><p>Before running the scripts, ensure you have the following:</p><ul><li>AWS account with appropriate permissions.</li><li>AWS CLI configured with your credentials.</li><li>Python 3.x or higher installed.</li><li>Required Python packages installed (see requirements.txt file).</li></ul><h3>Setup</h3><h3>Step 1: Clone the Repository</h3><p>First, clone the repository to your local machine:</p><pre>git clone https://github.com/Peterkinywa/NBADataLake<br>cd NBADataLake</pre><h3>Step 2: Install Required Python Packages</h3><p>Install the necessary Python packages using pip:</p><pre>pip install -r requirements.txt</pre><h3>Step 3: Create a .env File</h3><p>Create a .env file in the src directory with your API key and endpoint:</p><pre>cd src<br>touch .env</pre><p>Add the following content to the .env file:</p><pre>SPORTS_DATA_API_KEY=&lt;your_sportsdata_api_key&gt;<br>NBA_ENDPOINT=https://api.sportsdata.io/v3/nba/scores/json/Players</pre><h3>Usage</h3><h3>Setting Up the Data Lake</h3><p>Run the nba_datalake.py script to set up the data lake:</p><pre>python src/nba_datalake.py</pre><p>This script will:</p><ol><li><strong>Create an S3 Bucket</strong>: An S3 bucket will be created to store raw and processed NBA data.</li><li><strong>Create a Glue Database</strong>: An AWS Glue database will be created to catalog the data.</li><li><strong>Fetch NBA Data</strong>: NBA data will be fetched from the Sportsdata.io API.</li><li><strong>Upload Data to S3</strong>: The fetched data will be uploaded to the S3 bucket.</li><li><strong>Create a Glue Table</strong>: An external table will be created in AWS Glue to query the data.</li><li><strong>Configure Athena</strong>: Amazon Athena will be configured to query the data stored in the S3 bucket.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*-VAreBuVL5fiahrUOcNL0Q.png" /></figure><h3>Querying Data with Athena</h3><p>After setting up the data lake, you can query the data using Amazon Athena. Here are the steps:</p><ol><li>Go to the Amazon Athena console.</li><li>Select the database created by the script.</li><li>Write and execute SQL queries to analyze the NBA data.</li></ol><h3>Deleting the Data Lake Resources</h3><p>Run the delete_resources.py script to delete the data lake resources:</p><pre>python delete_resources.py</pre><p>This script will:</p><ol><li><strong>Delete the S3 Bucket</strong>: The S3 bucket and its contents will be deleted.</li><li><strong>Delete the Glue Database</strong>: The AWS Glue database and associated tables will be deleted.</li><li><strong>Delete Athena Query Results</strong>: Any Athena query results stored in the S3 bucket will be deleted.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*WXr6Ly_qfca8_AN7A3F1ZQ.png" /></figure><h3>IAM Policy</h3><p>The iam_role_policy.json file contains the IAM policy required for the scripts to execute successfully.</p><h3>Conclusion</h3><p>This project demonstrates how to automate the creation of a data lake for NBA analytics using AWS services. By leveraging Amazon S3, AWS Glue, and Amazon Athena, we can store and query large datasets. Check out the full project on GitHub and try it out for yourself!</p><p><a href="https://github.com/Peterkinywa/NBADataLake">GitHub Repository: NBA Data Lake on AWS</a></p><p>#AWS #DevOps</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24c47582664a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[30 Days DevOps Challenge — Weather Dashboard]]></title>
            <link>https://medium.com/@kinyywa/30-days-devops-challenge-weather-dashboard-b390641ced11?source=rss-33bd0d05bf1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b390641ced11</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Peter Kinywa]]></dc:creator>
            <pubDate>Fri, 10 Jan 2025 11:32:50 GMT</pubDate>
            <atom:updated>2025-01-10T11:36:33.381Z</atom:updated>
            <content:encoded><![CDATA[<h3>30 Days DevOps Challenge — Weather Dashboard</h3><h3>Building a Weather Dashboard using AWS S3 and OpenWeather API Integration</h3><h3>Project Visualization</h3><p>For this project, we developed a weather dashboard that fetches real-time weather data for multiple cities through an external API integration (OpenWeather API). This data is automatically stored in an AWS S3 bucket and displayed to users.</p><h3>Features</h3><ul><li>Fetches weather data for multiple cities from OpenWeather.</li><li>Stores weather data in an AWS S3 bucket.</li><li>Displays temperature, humidity, and weather conditions.</li></ul><h3>Technical Architecture</h3><ul><li>Language: <em>Python 3.13.1</em></li><li>Cloud Provider: <em>AWS (S3)</em></li><li>External API: <em>OpenWeather API </em><a href="https://openweathermap.org/api"><em>Link</em></a></li><li>Dependencies:</li></ul><pre>boto3 (AWS SDK Python used to interact with AWS services like S3)<br>python-dotenv (Manages our environment variables)<br>requests (We are able to make HTTP requests to the OpenWeather API)</pre><h3>Project Structure</h3><pre>weather-dashboard/<br>  src/<br>    __init__.py<br>    weather_dashboard.py<br>  tests<br>  .env<br>  .gitignore<br>  requirements.txt</pre><h3>Setup Instructions</h3><ol><li>Clone the repository:</li></ol><pre>git clone https://github.com/Peterkinywa/weather-dashboard-demo</pre><p>2. Navigate to the project directory:</p><pre>cd weather-dashboard</pre><p>3. Install dependencies:</p><pre>pip install -r requirements.txt</pre><p>4. Configure environment variables (.env):</p><pre>OPENWEATHER_API_KEY=your_api_key<br>AWS_BUCKET_NAME=your_unique_bucket_name</pre><p>5. Configure AWS credentials:</p><pre>aws configure<br>- AWS Access Key ID<br>- AWS Secret Access Key<br>- Default region name [e.g., us-east-1]<br>- Default output format [e.g., json]</pre><p>6. Run the application:</p><pre>python src/weather_dashboard.py</pre><p>7. View the fetched weather data in your terminal, displaying temperature, humidity, and weather conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*l4mKnAauh7n8yaoQyWZaPg.png" /></figure><p>8. Navigate to your AWS Console and check your AWS S3 Bucket for weather data files stored in the bucket.</p><p>9. Empty your bucket and delete your S3 bucket to avoid incurring any unbudgeted costs.</p><h3>Happy Developing!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b390641ced11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NBA Game Day Notifications — 30 Day DevOps Challenge]]></title>
            <link>https://medium.com/@kinyywa/nba-game-day-notifications-30-day-devops-challenge-fd4ef3ca9b1a?source=rss-33bd0d05bf1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd4ef3ca9b1a</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[eventbridge]]></category>
            <dc:creator><![CDATA[Peter Kinywa]]></dc:creator>
            <pubDate>Fri, 10 Jan 2025 11:07:43 GMT</pubDate>
            <atom:updated>2025-01-19T08:57:10.731Z</atom:updated>
            <content:encoded><![CDATA[<h3>NBA Game Day Notifications — 30 Day DevOps Challenge</h3><h3>Project Overview</h3><p>This project is an event-driven alert system that sends real-time NBA game day score notifications to subscribed users via Email.</p><h3>Features</h3><ul><li>Fetches live NBA game info using the external NBA API.</li><li>Transforms the info into a human-readable format and publishes to an Amazon SNS Topic.</li><li>Sends game notifications to subscribers through Email.</li><li>Automates regular updates and invocations using Amazon EventBridge.</li></ul><h3>Prerequisites</h3><ul><li>Free account with subscription and API Key at <a href="https://sportsdata.io/">sportsdata.io</a></li><li>Personal AWS account (Free Tier)</li><li>Basic understanding of AWS and Python</li></ul><h3>Technical Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v-UgQMNxuOpWR0LDvFo5tQ.png" /><figcaption>Technical Architecture</figcaption></figure><h3>Technologies</h3><ul><li>Cloud Provider: AWS</li><li>Core AWS Services: SNS, Lambda, EventBridge</li><li>External API: NBA Game API (<a href="https://sportsdata.io/">SportsData.io</a>)</li><li>Programming Language: Python 3.x</li><li>IAM Security:</li><li>Least privilege policies for Lambda, SNS, and EventBridge.</li></ul><h3>Project Structure</h3><p>bash</p><pre>game-day-notifications/<br>├── src/<br>│ ├── nba_notifications.py # Main Lambda function code<br>├── policies/<br>│ ├── nba_sns_policy.json # SNS publishing permissions<br>│ ├── nba_eventbridge_policy.json # EventBridge to Lambda permissions<br>│ └── nba_lambda_policy.json # Lambda execution role permissions<br>├── .gitignore<br>└── README.md # Project documentation</pre><h3>Setup Instructions</h3><h3>Clone the Repository</h3><pre>git clone https://github.com/Peterkinywa/game-day-notifications<br>cd game-day-notifications</pre><h3>Create an SNS Topic</h3><ol><li>Open AWS Management Console, navigate to SNS, and create a topic (e.g., nba_topic).</li></ol><h3>Add Subscriptions to the SNS Topic</h3><ol><li>Select the topic, click “Create subscription”, and enter a valid email address.</li><li>Confirm the subscription via the email link.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*GfuoUkke6sMFMZBTFDfJRA.png" /></figure><h3>Create the SNS Publish Policy</h3><ol><li>In IAM, go to Policies → Create Policy.</li><li>Paste the JSON policy from nba_sns_policy.json, replacing REGION and ACCOUNT_ID.</li><li>Name the policy (e.g., nba_sns_policy.json) and create it.</li></ol><h3>Create an IAM Role for Lambda</h3><ol><li>In IAM, go to Roles → Create Role.</li><li>Select AWS Service → Lambda.</li><li>Attach nba_sns_policy and AWSLambdaBasicExecutionRole.</li><li>Name the role (e.g., nba_role) and create it.</li><li>Save the role ARN.</li></ol><h3>Deploy the Lambda Function</h3><ol><li>In Lambda, click “Create Function”.</li><li>Name it (e.g., nba_notifications), choose Python 3.13, and assign nba_role.</li><li>Copy code from src/nba_notifications.py into the editor and deploy.</li><li>Add environment variables: NBA_API_KEY and SNS_TOPIC_ARN.</li><li>Create the function.</li></ol><h3>Set Up Automation with EventBridge</h3><ol><li>In EventBridge, create a rule with Event Source: Schedule.</li><li>Set the cron schedule (e.g., cron (0/10 8-23 * * ? *)).</li><li>Select the Lambda function (nba_notifications) as the target.</li></ol><h3>Test the System</h3><ol><li>Create a test event in Lambda and run it.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*PnGW3d63m028pCynBWhtig.png" /><figcaption>Test event results</figcaption></figure><p>2. Verify SMS notifications are sent to subscribers.</p><p>Here’s my GitHub Repository <a href="https://lnkd.in/dPuQjSVQ">https://lnkd.in/dPuQjSVQ</a></p><p>Here’s my LinkedIn post <a href="https://www.linkedin.com/posts/peterkinywamutua_devopsallstarschallenge-aws-activity-7283431069360533504-oIt_?utm_source=share&amp;utm_medium=member_desktop">https://www.linkedin.com/posts/peterkinywamutua_devopsallstarschallenge-aws-activity-7283431069360533504-oIt_?utm_source=share&amp;utm_medium=member_desktop</a></p><p>This project was designed with security in mind, following the principle of least privilege for IAM roles.</p><p>#DevOps #AWS</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd4ef3ca9b1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>