<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: AdesegunA</title>
    <description>The latest articles on DEV Community by AdesegunA (@iamsegz).</description>
    <link>https://dev.to/iamsegz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F841066%2F0af22c8b-4c10-45be-810b-f42083f1ffb1.jpg</url>
      <title>DEV Community: AdesegunA</title>
      <link>https://dev.to/iamsegz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iamsegz"/>
    <language>en</language>
    <item>
      <title>NCAA Game Highlights</title>
      <dc:creator>AdesegunA</dc:creator>
      <pubDate>Mon, 03 Feb 2025 14:48:42 +0000</pubDate>
      <link>https://dev.to/iamsegz/ncaa-game-highlights-11p</link>
      <guid>https://dev.to/iamsegz/ncaa-game-highlights-11p</guid>
      <description>&lt;h1&gt;
  
  
  Highlight Processors
&lt;/h1&gt;

&lt;p&gt;This project utilizes RapidAPI to fetch NCAA game highlights within a Docker container and leverages AWS MediaConvert to process and convert the media files.&lt;/p&gt;

&lt;h1&gt;
  
  
  File Overview
&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;config.py&lt;/code&gt; script carries out the following functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It imports essential environment variables and maps them to Python variables, assigning default values when necessary.&lt;/li&gt;
&lt;li&gt;This method ensures flexible configuration management, allowing different settings for various environments (e.g., development, staging, production) without altering the source code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;fetch.py&lt;/code&gt; script performs the following actions:&lt;/p&gt;

&lt;p&gt;Establishes the date and league that will be used to find highlights. We are using NCAA in this example because it's included in the free version.&lt;br&gt;
This will fetch the highlights from the API and store them in an S3 bucket as a JSON file (basketball_highlight.json)&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;process_one_video.py&lt;/code&gt; performs the following actions:&lt;/p&gt;

&lt;p&gt;Connects to the S3 bucket and retrieves the JSON file.&lt;br&gt;
Extracts the first video URL from within the JSON file.&lt;br&gt;
Downloads the video fiel from the internet into the memory using the requests library.&lt;br&gt;
Saves the video as a new file in the S3 bucket under a different folder (videos/)&lt;br&gt;
Logs the status of each step&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;mediaconvert_process.py&lt;/code&gt; performs the following actions:&lt;/p&gt;

&lt;p&gt;Creates and submits a MediaConvert job&lt;br&gt;
Uses MediaConvert to process a video file - configures the video codec, resolution and bitrate. Also configured the audio settings&lt;br&gt;
Stores the processed video back into an S3 bucket&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;run_all.py&lt;/code&gt; performs the following actions:&lt;br&gt;
Runs the scripts in a chronological order and provides buffer time for the tasks to be created.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;.env&lt;/code&gt; file stores all over the environment variables, these are variables that we don't want to hardcode into our script.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;Dockerfile&lt;/code&gt; performs the following actions:&lt;br&gt;
Provides the step by step approach to build the image.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;Terraform Scripts:&lt;/code&gt;&lt;br&gt;
These scripts are used to created resources in AWS in a scalable and repeatable way. All of the resources we work with like  S3, creating IAM user roles, elastic registry service and elastic container services is built here.&lt;/p&gt;
&lt;h1&gt;
  
  
  Prerequisites
&lt;/h1&gt;

&lt;p&gt;Before running the scripts, ensure you have the following:&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;1.&lt;/strong&gt; Create Rapidapi Account
&lt;/h2&gt;

&lt;p&gt;Rapidapi.com account, will be needed to access highlight images and videos.&lt;/p&gt;

&lt;p&gt;For this example we will be using NCAA (USA College Basketball) highlights since it's included for free in the basic plan.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://rapidapi.com/highlightly-api-highlightly-api-default/api/sport-highlights-api/playground/apiendpoint_16dd5813-39c6-43f0-aebe-11f891fe5149" rel="noopener noreferrer"&gt;Sports Highlights API&lt;/a&gt; is the endpoint we will be using &lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;2.&lt;/strong&gt; Verify prerequites are installed in your Local Environment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Ensure Docker should is pre-installed in most regions. you can check by typing &lt;code&gt;docker --version&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensure AWS CloudShell has AWS CLI pre-installed.you can check by typing  &lt;code&gt;aws --version&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensure Python3 is pre-installed also &lt;code&gt;python3 --version&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;3.&lt;/strong&gt; Retrieve AWS Account ID
&lt;/h2&gt;

&lt;p&gt;Copy your AWS Account ID Once logged in to the AWS Management Console Click on your account name in the top right corner You will see your account ID Copy and save this somewhere safe because you will need to update codes in the labs later&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;4.&lt;/strong&gt; Retrieve Access Keys and Secret Access Keys
&lt;/h2&gt;

&lt;p&gt;You can check to see if you have an access key in the IAM dashboard&lt;br&gt;
Under Users, click on a user and then "Security Credentials"&lt;br&gt;
Scroll down until you see the Access Key section&lt;br&gt;
You will not be able to retrieve your secret access key so if you don't have that somewhere, you need to create an access key.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Technical Diagram&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fotqfn84l8bqbcaai46tx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fotqfn84l8bqbcaai46tx.png" alt="GameHighlightProcessor" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Project Structure&lt;/strong&gt;
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;src/
├── Dockerfile
├── config.py
├── fetch.py
├── mediaconvert_process.py
├── process_one_video.py
├── requirements.txt
├── run_all.py
├── .env
├── .gitignore
└── terraform/
    ├── main.tf
    ├── variables.tf
    ├── secrets.tf
    ├── iam.tf
    ├── ecr.tf
    ├── ecs.tf
    ├── s3.tf
    ├── container_definitions.tpl
    └── outputs.tf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h1&gt;
  
  
  INSTRUCTIONS
&lt;/h1&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Step 1: Clone The Repo&lt;/strong&gt;
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/adesegunasunmo/gaming-highlight-processors.git
&lt;span class="nb"&gt;cd &lt;/span&gt;src
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step 2: Add API Key to AWS Secrets Manager&lt;/strong&gt;
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws secretsmanager create-secret 
    &lt;span class="nt"&gt;--name&lt;/span&gt; my-api-key 
    &lt;span class="nt"&gt;--description&lt;/span&gt; &lt;span class="s2"&gt;"API key for accessing the Sport Highlights API"&lt;/span&gt; 
    &lt;span class="nt"&gt;--secret-string&lt;/span&gt; &lt;span class="s1"&gt;'{"api_key":"YOUR_ACTUAL_API_KEY"}'&lt;/span&gt; 
    &lt;span class="nt"&gt;--region&lt;/span&gt; us-east-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step 3: Create an IAM role or user&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In the search bar type "IAM" &lt;/p&gt;

&lt;p&gt;Click Roles -&amp;gt; Create Role&lt;/p&gt;

&lt;p&gt;For the Use Case type "S3" and click next&lt;/p&gt;

&lt;p&gt;Under Add Permission search for AmazonS3FullAccess, MediaConvertFullAccess and AmazonEC2ContainerRegistryFullAccess and click next&lt;/p&gt;

&lt;p&gt;Under Role Details, type "HighlightProcessorRole" as the name&lt;/p&gt;

&lt;p&gt;Select Create Role&lt;/p&gt;

&lt;p&gt;Find the role in the list and click on it&lt;br&gt;
Under Trust relationships&lt;br&gt;
Edit the trust policy to this:&lt;br&gt;
Edit the Trust Policy and replace it with this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"Version"&lt;/span&gt;: &lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;,
  &lt;span class="s2"&gt;"Statement"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
    &lt;span class="o"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"Effect"&lt;/span&gt;: &lt;span class="s2"&gt;"Allow"&lt;/span&gt;,
      &lt;span class="s2"&gt;"Principal"&lt;/span&gt;: &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"Service"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;
          &lt;span class="s2"&gt;"ec2.amazonaws.com"&lt;/span&gt;,
          &lt;span class="s2"&gt;"ecs-tasks.amazonaws.com"&lt;/span&gt;,
          &lt;span class="s2"&gt;"mediaconvert.amazonaws.com"&lt;/span&gt;
        &lt;span class="o"&gt;]&lt;/span&gt;,
        &lt;span class="s2"&gt;"AWS"&lt;/span&gt;: &lt;span class="s2"&gt;"arn:aws:iam::&amp;lt;"&lt;/span&gt;your-account-id&lt;span class="s2"&gt;"&amp;gt;:user/&amp;lt;"&lt;/span&gt;your-iam-user&lt;span class="s2"&gt;"&amp;gt;"&lt;/span&gt;
      &lt;span class="o"&gt;}&lt;/span&gt;,
      &lt;span class="s2"&gt;"Action"&lt;/span&gt;: &lt;span class="s2"&gt;"sts:AssumeRole"&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Step 4: Update .env file&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;RapidAPI_KEY: Ensure that you have successfully created the account and select "Subscribe To Test" in the top left of the Sports Highlights API&lt;/li&gt;
&lt;li&gt;AWS_ACCESS_KEY_ID=your_aws_access_key_id_here&lt;/li&gt;
&lt;li&gt;AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key_here&lt;/li&gt;
&lt;li&gt;S3_BUCKET_NAME=your_S3_bucket_name_here&lt;/li&gt;
&lt;li&gt;MEDIACONVERT_ENDPOINT=&lt;a href="https://your_mediaconvert_endpoint_here.amazonaws.com" rel="noopener noreferrer"&gt;https://your_mediaconvert_endpoint_here.amazonaws.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws mediaconvert describe-endpoints
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;MEDIACONVERT_ROLE_ARN=arn:aws:iam::your_account_id:role/HighlightProcessorRole&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step 5: Secure .env file&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;600 .env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Step 6: Locally Buikd &amp;amp; Run The Docker Container&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker build &lt;span class="nt"&gt;-t&lt;/span&gt; highlight-processor &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the Docker Container Locally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--env-file&lt;/span&gt; .env highlight-processor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will run fetch.py, process_one_video.py and mediaconvert_process.py and the following files should be saved in your S3 bucket:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2eb1z3h83ajy1bejo5ex.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2eb1z3h83ajy1bejo5ex.png" alt="Image description" width="800" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Optional - Confirm there is a video uploaded to s3:///videos/first_video.mp4&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb5f7ys69x177a80hzqdb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb5f7ys69x177a80hzqdb.png" alt="Image description" width="800" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Optional - Confirm there is a video uploaded to s3:///processed_videos/&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What We Learned&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Working with Docker and AWS Services&lt;/li&gt;
&lt;li&gt;Identity Access Management (IAM) and least privilege&lt;/li&gt;
&lt;li&gt;How to enhance media quality &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Remember to delete all the resources you created on AWS once you’re done so as not to incur any costs!!!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>GameTracker API System</title>
      <dc:creator>AdesegunA</dc:creator>
      <pubDate>Mon, 03 Feb 2025 12:19:08 +0000</pubDate>
      <link>https://dev.to/iamsegz/gametracker-api-system-heg</link>
      <guid>https://dev.to/iamsegz/gametracker-api-system-heg</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Project Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This project demonstrates building a robust and scalable API management system for querying real-time sports data. It leverages the power of Amazon's cloud services, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon ECS (Fargate):&lt;/strong&gt; for containerized, serverless execution of the backend application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon API Gateway:&lt;/strong&gt; for exposing secure and scalable RESTful endpoints for querying sports data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon CloudWatch:&lt;/strong&gt; for monitoring and logging application performance and health.
This project showcases best practices in cloud architecture, including:&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Management:&lt;/strong&gt; API Gateway provides a central hub for managing and securing API access.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Container Orchestration:&lt;/strong&gt; ECS Fargate simplifies container deployment and management.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secure AWS Integrations:&lt;/strong&gt; IAM policies ensure least privilege access for API Gateway and ECS tasks.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Features&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Exposes a well-documented and easy-to-use REST API for retrieving real-time sports data.&lt;/li&gt;
&lt;li&gt;Runs a containerized backend application using Amazon ECS with Fargate for scalability and serverless operation.&lt;/li&gt;
&lt;li&gt;Employs a scalable and serverless architecture to handle fluctuating workloads efficiently.&lt;/li&gt;
&lt;li&gt;Leverages Amazon API Gateway for API management and routing, simplifying API development and deployment.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Prerequisites&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sports API Key&lt;/strong&gt;: Sign up for a free account and subscription &amp;amp; obtain your API Key at serpapi.com&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Account&lt;/strong&gt;: Create an AWS Account &amp;amp; have basic understanding of ECS, API Gateway, Docker &amp;amp; Python&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS CLI Installed and Configured&lt;/strong&gt;:  Install and configure the AWS CLI to interact with AWS services programmatically. You can find detailed instructions in the AWS documentation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Serpapi Library&lt;/strong&gt;: Install Serpapi library in local environment "pip install google-search-results"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker CLI and Desktop Installed&lt;/strong&gt;: Install Docker for building and pushing container images.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Technical Architecture&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz5l7h4hkgp4354k0qpyd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz5l7h4hkgp4354k0qpyd.png" alt="NPL" width="651" height="253"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Technologies&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Provider&lt;/strong&gt;: AWS&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Core Services&lt;/strong&gt;: Amazon ECS (Fargate), API Gateway, CloudWatch&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Programming Language&lt;/strong&gt;: Python 3.x&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Containerization&lt;/strong&gt;: Docker&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IAM Security&lt;/strong&gt;: Custom least privilege policies for ECS task execution and API Gateway&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Project Structure&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sports-api-management/
├── app.py &lt;span class="c"&gt;# Flask application for querying sports data&lt;/span&gt;
├── Dockerfile &lt;span class="c"&gt;# Dockerfile to containerize the Flask app&lt;/span&gt;
├── requirements.txt &lt;span class="c"&gt;# Python dependencies&lt;/span&gt;
├── .gitignore
└── README.md &lt;span class="c"&gt;# Project documentation&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Setup Instructions&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Clone the Repository&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/adesegunasunmo/sports-api-container.git
&lt;span class="nb"&gt;cd &lt;/span&gt;containerized-sports-api
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Create ECR Repo&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws ecr create-repository &lt;span class="nt"&gt;--repository-name&lt;/span&gt; sports-api &lt;span class="nt"&gt;--region&lt;/span&gt; us-east-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Authenticate Build and Push the Docker Image&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws ecr get-login-password &lt;span class="nt"&gt;--region&lt;/span&gt; us-east-1 | docker login &lt;span class="nt"&gt;--username&lt;/span&gt; AWS &lt;span class="nt"&gt;--password-stdin&lt;/span&gt; &amp;lt;AWS_ACCOUNT_ID&amp;gt;.dkr.ecr.us-east-1.amazonaws.com

docker build &lt;span class="nt"&gt;--platform&lt;/span&gt; linux/amd64 &lt;span class="nt"&gt;-t&lt;/span&gt; sports-api &lt;span class="nb"&gt;.&lt;/span&gt;
docker tag sports-api:latest &amp;lt;AWS_ACCOUNT_ID&amp;gt;.dkr.ecr.us-east-1.amazonaws.com/sports-api:sports-api-latest
docker push &amp;lt;AWS_ACCOUNT_ID&amp;gt;.dkr.ecr.us-east-1.amazonaws.com/sports-api:sports-api-latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Set Up ECS Cluster with Fargate&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create an ECS Cluster:&lt;/li&gt;
&lt;li&gt;Go to the ECS Console → Clusters → Create Cluster&lt;/li&gt;
&lt;li&gt;Name your Cluster (sports-api-cluster)&lt;/li&gt;
&lt;li&gt;For Infrastructure, select Fargate, then create Cluster&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6gpyvlx1yxoh2yv476y6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6gpyvlx1yxoh2yv476y6.png" alt="Image description" width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a Task Definition:&lt;/li&gt;
&lt;li&gt;Go to Task Definitions → Create New Task Definition&lt;/li&gt;
&lt;li&gt;Name your task definition (sports-api-task)&lt;/li&gt;
&lt;li&gt;For Infrastructure, select Fargate&lt;/li&gt;
&lt;li&gt;Add the container:

&lt;ul&gt;
&lt;li&gt;Name your container (sports-api-container)&lt;/li&gt;
&lt;li&gt;Image URI: .dkr.ecr.us-east-1.amazonaws.com/sports-api:sports-api-latest&lt;/li&gt;
&lt;li&gt;Container Port: 8080&lt;/li&gt;
&lt;li&gt;Protocol: TCP&lt;/li&gt;
&lt;li&gt;Port Name: Leave Blank&lt;/li&gt;
&lt;li&gt;App Protocol: HTTP&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Define Environment Eariables:

&lt;ul&gt;
&lt;li&gt;Key: SPORTS_API_KEY&lt;/li&gt;
&lt;li&gt;Value: &lt;/li&gt;
&lt;li&gt;Create task definition&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi5wyobnsztvui2y5ce2l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi5wyobnsztvui2y5ce2l.png" alt="Image description" width="800" height="334"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkh7t005ir1shvotqia8d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkh7t005ir1shvotqia8d.png" alt="Image description" width="800" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run the Service with an ALB&lt;/li&gt;
&lt;li&gt;Go to Clusters → Select Cluster → Service → Create.&lt;/li&gt;
&lt;li&gt;Capacity provider: Fargate&lt;/li&gt;
&lt;li&gt;Select Deployment configuration family (sports-api-task)&lt;/li&gt;
&lt;li&gt;Name your service (sports-api-service)&lt;/li&gt;
&lt;li&gt;Desired tasks: 2&lt;/li&gt;
&lt;li&gt;Networking: Create new security group&lt;/li&gt;
&lt;li&gt;Networking Configuration:

&lt;ul&gt;
&lt;li&gt;Type: All TCP&lt;/li&gt;
&lt;li&gt;Source: Anywhere&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Load Balancing: Select Application Load Balancer (ALB).&lt;/li&gt;
&lt;li&gt;ALB Configuration:

&lt;ul&gt;
&lt;li&gt;Create a new ALB:&lt;/li&gt;
&lt;li&gt;Name: sports-api-alb&lt;/li&gt;
&lt;li&gt;Target Group health check path: "/sports"&lt;/li&gt;
&lt;li&gt;Create service&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4l8b0g36bab2tc7pd3gm.png" alt="Image description" width="800" height="335"&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Test the ALB:&lt;/li&gt;
&lt;li&gt;After deploying the ECS service, note the DNS name of the ALB (e.g., sports-api-alb-.us-east-1.elb.amazonaws.com)&lt;/li&gt;
&lt;li&gt;Confirm the API is accessible by visiting the ALB DNS name in your browser and adding /sports at end (e.g, &lt;a href="http://sports-api-alb-" rel="noopener noreferrer"&gt;http://sports-api-alb-&lt;/a&gt;.us-east-1.elb.amazonaws.com/sports)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvpddar2e9463uz4h9lqc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvpddar2e9463uz4h9lqc.png" alt="Image description" width="800" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Configure API Gateway&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create a New REST API:&lt;/li&gt;
&lt;li&gt;Go to API Gateway Console → Create API → REST API&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Name the API (e.g., Sports API Gateway)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set Up Integration:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a resource /sports&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a GET method&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose HTTP Proxy as the integration type&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enter the DNS name of the ALB that includes "/sports" (e.g. &lt;a href="http://sports-api-alb-" rel="noopener noreferrer"&gt;http://sports-api-alb-&lt;/a&gt;.us-east-1.elb.amazonaws.com/sports&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deploy the API:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deploy the API to a stage (e.g., prod)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Note the endpoint URL&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Test the System&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use curl or a browser to test:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://&amp;lt;api-gateway-id&amp;gt;.execute-api.us-east-1.amazonaws.com/prod/sports
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fri7ajl0eij8741xasynh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fri7ajl0eij8741xasynh.png" alt="Image description" width="800" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What We Learned&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Deploying a Scalable, Containerized Application with Amazon ECS and exposing Public APIs via API Gateway.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Future Enhancements&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Add caching for frequent API requests using Amazon ElastiCache&lt;/li&gt;
&lt;li&gt;Add DynamoDB to store user-specific queries and preferences&lt;/li&gt;
&lt;li&gt;Secure the API Gateway using an API key or IAM-based authentication&lt;/li&gt;
&lt;li&gt;Implement CI/CD for automating container deployments
rmation layer with AWS Glue ETL.&lt;/li&gt;
&lt;li&gt;Add advanced analytics and visualizations using AWS QuickSight.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Important Reminder:&lt;/strong&gt;&lt;br&gt;
Don't forget to delete all the resources you created once you're done. Services like S3, ECS, ECR e.t.c, can incur costs, so make sure to clean up!&lt;br&gt;
Thank you for reading, and I hope you found this guide helpful. Keep learning and building!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>NBA Game Day Notifications /Sports Alerts System</title>
      <dc:creator>AdesegunA</dc:creator>
      <pubDate>Tue, 21 Jan 2025 13:37:52 +0000</pubDate>
      <link>https://dev.to/iamsegz/nba-game-day-notifications-sports-alerts-system-j74</link>
      <guid>https://dev.to/iamsegz/nba-game-day-notifications-sports-alerts-system-j74</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Project Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Stay on top of the game!This project is a &lt;strong&gt;real time NBA Game Day Notifications System&lt;/strong&gt; that delivers live score updates straight to your inbox or phone via &lt;strong&gt;SMS/Email&lt;/strong&gt;. Built using &lt;strong&gt;AWS Services&lt;/strong&gt; and &lt;strong&gt;NBA APIs&lt;/strong&gt;, it showcases how to design a secure, scalable, and automated cloud-based notification system. Perfect for sports enthusiasts and techies exploring AWS and Python-based solutions.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Key Features&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live Score Updates&lt;/strong&gt;: Fetches live NBA scores from the &lt;strong&gt;NBA Game API&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real-Time Notifications&lt;/strong&gt;: Sends formatted updates via &lt;strong&gt;Amazon SNS&lt;/strong&gt; (SMS/Email).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automated Scheduling&lt;/strong&gt;: Uses &lt;strong&gt;Amazon EventBridge&lt;/strong&gt; for regular updates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security-Focused Design&lt;/strong&gt;: Implements the &lt;strong&gt;principle of least privilege&lt;/strong&gt; for AWS IAM roles.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Tech Stack&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Provider&lt;/strong&gt;: AWS&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Core Services&lt;/strong&gt;: Amazon SNS, AWS Lambda, EventBridge&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API&lt;/strong&gt;: NBA Game API from &lt;a href="https://sportsdata.io/" rel="noopener noreferrer"&gt;SportsData.io&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Language&lt;/strong&gt;: Python 3.x&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security&lt;/strong&gt;: Custom IAM policies for secure integration&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Architecture Overview&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8blp34wfimfjkywre5od.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8blp34wfimfjkywre5od.png" alt="nba_API" width="800" height="738"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon EventBridge&lt;/strong&gt;: Automates scheduling of the Lambda function to fetch live game data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Lambda&lt;/strong&gt;: Executes the notification logic in real time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon SNS&lt;/strong&gt;: Sends game day updates to users via SMS and Email.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Project Structure&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;game-day-notifications/
├── src/
│   ├── gd_notifications.py          &lt;span class="c"&gt;# Main Lambda function code&lt;/span&gt;
├── policies/
│   ├── gd_sns_policy.json           &lt;span class="c"&gt;# SNS publishing permissions&lt;/span&gt;
│   ├── gd_eventbridge_policy.json   &lt;span class="c"&gt;# EventBridge to Lambda permissions&lt;/span&gt;
│   └── gd_lambda_policy.json        &lt;span class="c"&gt;# Lambda execution role permissions&lt;/span&gt;
├── .gitignore
└── README.md                        &lt;span class="c"&gt;# Project documentation&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Getting Started&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Prerequisites&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NBA API Key:&lt;/strong&gt; Get your free API key from &lt;a href="https://sportsdata.io/" rel="noopener noreferrer"&gt;SportsData.io&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Account:&lt;/strong&gt; Familiarity with AWS services and Python is a plus!&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Clone the Repository&lt;/strong&gt;
&lt;/h3&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone git@github.com:adesegunasunmo/Game-Day-Notifications.git
&lt;span class="nb"&gt;cd &lt;/span&gt;Game-Day-Notifications
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Step-by-Step Setup&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Create an SNS Topic&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open the AWS Management Console.&lt;/li&gt;
&lt;li&gt;Navigate to the SNS service.&lt;/li&gt;
&lt;li&gt;Click Create Topic and select Standard as the topic type.&lt;/li&gt;
&lt;li&gt;Name the topic (e.g., gd_topic) and note the ARN.&lt;/li&gt;
&lt;li&gt;Click Create Topic.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Add Subscriptions to the SNS Topic&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;After creating the topic, click on the topic name from the list.&lt;/li&gt;
&lt;li&gt;Navigate to the Subscriptions tab and click Create subscription.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select a Protocol: For Email:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose Email.&lt;/li&gt;
&lt;li&gt;Enter a valid email address.&lt;/li&gt;
&lt;li&gt;For SMS (phone number):&lt;/li&gt;
&lt;li&gt;Choose SMS.&lt;/li&gt;
&lt;li&gt;Enter a valid phone number in international format (e.g., +1234567890).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click Create Subscription.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you added an Email subscription:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check the inbox of the provided email address.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Confirm the subscription by clicking the confirmation link in the email.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For SMS, the subscription will be immediately active after creation.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Create an SNS Topic Policy&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open the IAM service in the AWS Management Console.&lt;/li&gt;
&lt;li&gt;Navigate to Policies → Create Policy.&lt;/li&gt;
&lt;li&gt;Click JSON and paste the JSON policy from gd_sns_policy.json file&lt;/li&gt;
&lt;li&gt;Replace REGION and ACCOUNT_ID with your AWS region and account ID.&lt;/li&gt;
&lt;li&gt;Click Next: Tags (you can skip adding tags).&lt;/li&gt;
&lt;li&gt;Click Next: Review.&lt;/li&gt;
&lt;li&gt;Enter a name for the policy (e.g., gd_sns_policy).&lt;/li&gt;
&lt;li&gt;Review and click Create Policy.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Create an IAM Role for Lambda&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open the IAM service in the AWS Management Console.&lt;/li&gt;
&lt;li&gt;Click Roles → Create Role.&lt;/li&gt;
&lt;li&gt;Select AWS Service and choose Lambda.&lt;/li&gt;
&lt;li&gt;Attach the following policies:&lt;/li&gt;
&lt;li&gt;SNS Publish Policy (gd_sns_policy) (created in the previous step).&lt;/li&gt;
&lt;li&gt;Lambda Basic Execution Role (AWSLambdaBasicExecutionRole) (an AWS managed policy).&lt;/li&gt;
&lt;li&gt;Click Next: Tags (you can skip adding tags).&lt;/li&gt;
&lt;li&gt;Click Next: Review.&lt;/li&gt;
&lt;li&gt;Enter a name for the role (e.g., gd_role).&lt;/li&gt;
&lt;li&gt;Review and click Create Role.&lt;/li&gt;
&lt;li&gt;Copy and save the ARN of the role for use in the Lambda function.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj1ptubm41134avtyol9b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj1ptubm41134avtyol9b.png" alt="image" width="720" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Deploy the Lambda Function&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Open the AWS Management Console and navigate to the Lambda service.&lt;/li&gt;
&lt;li&gt;Click Create Function.&lt;/li&gt;
&lt;li&gt;Select Author from Scratch.&lt;/li&gt;
&lt;li&gt;Enter a function name (e.g., gd_notifications).&lt;/li&gt;
&lt;li&gt;Choose Python 3.x as the runtime.&lt;/li&gt;
&lt;li&gt;Assign the IAM role created earlier (gd_role) to the function.&lt;/li&gt;
&lt;li&gt;Under the Function Code section:&lt;/li&gt;
&lt;li&gt;Copy the content of the src/gd_notifications.py file from the repository.&lt;/li&gt;
&lt;li&gt;Paste it into the inline code editor.&lt;/li&gt;
&lt;li&gt;Under the Environment Variables section, add the following:&lt;/li&gt;
&lt;li&gt;NBA_API_KEY: your NBA API key.&lt;/li&gt;
&lt;li&gt;SNS_TOPIC_ARN: the ARN of the SNS topic created earlier.&lt;/li&gt;
&lt;li&gt;Click Create Function.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Automate with Eventbridge&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the Eventbridge service in the AWS Management Console.&lt;/li&gt;
&lt;li&gt;Go to Rules → Create Rule.&lt;/li&gt;
&lt;li&gt;Select Event Source: Schedule.&lt;/li&gt;
&lt;li&gt;Set the cron schedule for when you want updates (e.g., hourly).&lt;/li&gt;
&lt;li&gt;Under Targets, select the Lambda function (gd_notifications) and save the rule.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fejh3lkdima4un4rsg7dl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fejh3lkdima4un4rsg7dl.png" alt="image" width="720" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F195kt5qqy26sqy6diga5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F195kt5qqy26sqy6diga5.png" alt="image" width="720" height="289"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Testing the System&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Open the Lambda function in the AWS Management Console.&lt;/li&gt;
&lt;li&gt;Create a test event to simulate execution.&lt;/li&gt;
&lt;li&gt;Run the function and check CloudWatch Logs for errors.&lt;/li&gt;
&lt;li&gt;Verify that SMS notifications are sent to the subscribed users.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Felvdzzmatw8ylgjcj1dn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Felvdzzmatw8ylgjcj1dn.png" alt="image" width="720" height="290"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What I Learned&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Setting up a cloud-based notification system with AWS SNS and Lambda.&lt;/li&gt;
&lt;li&gt;Best practices for securing AWS resources with IAM..&lt;/li&gt;
&lt;li&gt;Integrating third-party APIs into serverless workflows.&lt;/li&gt;
&lt;li&gt;Automating tasks with EventBridge and Lambda.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Remember to delete all the resources you created on AWS once you’re done so as not to incur any costs!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Thank you for reading, and I hope you found this guide helpful. Keep learning and building!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Building a Weather Data Collection System with AWS S3 and OpenWeather API</title>
      <dc:creator>AdesegunA</dc:creator>
      <pubDate>Tue, 21 Jan 2025 12:13:38 +0000</pubDate>
      <link>https://dev.to/iamsegz/building-a-weather-data-collection-system-with-aws-s3-and-openweather-api-333f</link>
      <guid>https://dev.to/iamsegz/building-a-weather-data-collection-system-with-aws-s3-and-openweather-api-333f</guid>
      <description>&lt;h2&gt;
  
  
  Project Overview
&lt;/h2&gt;

&lt;p&gt;This project is a Weather Data Collection System that demonstrates core DevOps principles by combining:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;External API Integration (OpenWeather API)&lt;/li&gt;
&lt;li&gt;Cloud Storage (AWS S3)&lt;/li&gt;
&lt;li&gt;Infrastructure as Code&lt;/li&gt;
&lt;li&gt;Version Control (Git)&lt;/li&gt;
&lt;li&gt;Python Development&lt;/li&gt;
&lt;li&gt;Error Handling&lt;/li&gt;
&lt;li&gt;Environment Management&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Fetches real-time weather data for multiple cities&lt;/li&gt;
&lt;li&gt;Displays temperature (°F), humidity, and weather conditions&lt;/li&gt;
&lt;li&gt;Automatically stores weather data in AWS S3&lt;/li&gt;
&lt;li&gt;Supports multiple cities tracking&lt;/li&gt;
&lt;li&gt;Timestamps all data for historical tracking&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Technical Architecture
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Language:&lt;/strong&gt; Python 3.x&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Provider:&lt;/strong&gt; AWS (S3)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;External API:&lt;/strong&gt; OpenWeather API&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dependencies:&lt;/strong&gt; 

&lt;ul&gt;
&lt;li&gt;boto3 (AWS SDK)&lt;/li&gt;
&lt;li&gt;python-dotenv&lt;/li&gt;
&lt;li&gt;requests&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Architectural Review
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faqux40piv4tozccjotpg.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faqux40piv4tozccjotpg.jpeg" alt="Weather-dashboard" width="800" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Structure
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;weather-dashboard/
  src/
    __init__.py
    weather_dashboard.py
  tests/
  data/
  .env
  .gitignore
  requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Ensure the following tools and credentials are set up on your local machine before proceeding:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;VS Code Editor&lt;/strong&gt; you can see documentation &lt;a href="https://code.visualstudio.com/download" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS CLI&lt;/strong&gt; you can see documentation &lt;a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Account:&lt;/strong&gt; Access credentials with sufficient permissions to interact with S3.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenWeather API Key:&lt;/strong&gt; Generate an API key by signing up at OpenWeather API.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setup Instructions
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Clone the repository:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  git clone git@github.com:adesegunasunmo/30-Days-DevOps-Challenge.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Create a Virtual Environment&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Before proceeding with the installation, it’s highly recommended to create a virtual environment for Python. This ensures that your package dependencies are isolated from the global environment. The installation might fail if the package is managed externally (e.g., through &lt;code&gt;apt&lt;/code&gt;). By isolating the environment, you can safely install and manage the required dependencies without interference.&lt;/p&gt;

&lt;p&gt;Then you have to activate the virtual environment &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source envname/bin/activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;To do this:&lt;/p&gt;

&lt;p&gt;Create a virtual environment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    python3 -m venv (your virtual environment name)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install dependencies
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   pip install -r requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Configure environment variables (.env):
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CopyOPENWEATHER_API_KEY=your_api_key
AWS_BUCKET_NAME=your_bucket_name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4.Configure AWS credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws configure

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Facpsqa8lmb2a86xj73jb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Facpsqa8lmb2a86xj73jb.png" alt="image" width="800" height="134"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5.Run the Application Execute the Python script to fetch and upload weather data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   python src/weather_dashboard.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fybueab98kpi1as789tpy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fybueab98kpi1as789tpy.png" alt="image" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What We Learned
&lt;/h2&gt;

&lt;p&gt;Working on this project helped me gain hands-on experience with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS S3: Creating and managing buckets.&lt;/li&gt;
&lt;li&gt;Environment Variable Management: Securing sensitive API keys.&lt;/li&gt;
&lt;li&gt;Python Best Practices: Writing clean, modular, and reusable code for API integration.&lt;/li&gt;
&lt;li&gt;Git Workflow: Using version control effectively for project development.&lt;/li&gt;
&lt;li&gt;Error Handling: Managing failures in distributed systems gracefully.&lt;/li&gt;
&lt;li&gt;Cloud Resource Management: Leveraging cloud services efficiently.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Future Enhancements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Add weather forecasting functionality.&lt;/li&gt;
&lt;li&gt;Implement data visualization for weather trends.&lt;/li&gt;
&lt;li&gt;Expand the city tracking feature.&lt;/li&gt;
&lt;li&gt;Create automated testing for better reliability.&lt;/li&gt;
&lt;li&gt;Set up a CI/CD pipeline for streamlined deployments.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Congratulations!&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;We have successfully completed &lt;strong&gt;&lt;em&gt;"Building a Weather Data Collection System with AWS S3 and OpenWeather API!" .&lt;/em&gt;&lt;/strong&gt; Great job!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7fkr0gb84kt2l10hid2l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7fkr0gb84kt2l10hid2l.png" alt="image" width="800" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I know it took a lot of clicking and configurations to set everything up. While tool like &lt;strong&gt;Docker&lt;/strong&gt; can automate this process, going through it manually is a great way to understand how all the components work together.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important Reminder:&lt;/strong&gt;&lt;br&gt;
Don't forget to delete all the resources you created once you're done. Services like S3 e.t.c, can incur small costs, so make sure to clean up!&lt;br&gt;
Thank you for reading, and I hope you found this guide helpful. Keep learning and building!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
