Skip to content

Instantly share code, notes, and snippets.

@lioneltchami
Created January 22, 2025 17:09
Show Gist options
  • Select an option

  • Save lioneltchami/e21d362f946868f433dda06ed0b147e6 to your computer and use it in GitHub Desktop.

Select an option

Save lioneltchami/e21d362f946868f433dda06ed0b147e6 to your computer and use it in GitHub Desktop.

Space Station Monitoring System on AWS

Project Overview

This will involve building a containerized application that simulates monitoring and managing a space station. The system consists of several microservices, each running in a Docker container, deployed on an AWS EC2 instance. The focus is on DevOps practices, emphasizing Docker, Linux, AWS, and automation through Bash scripting.

Components

  1. Station Status Dashboard

    • A simple React frontend that displays space station status
    • Served using Nginx
  2. Status API Service

    • A lightweight Express.js API that provides station status data
    • Stores data in Amazon DynamoDB
  3. Resource Monitor

    • A Bash script that monitors system resources (CPU, memory, disk usage)
    • Outputs data to Amazon CloudWatch Logs
  4. Alert System

    • A Python script that reads CloudWatch Logs and sends alerts via Amazon SES
  5. Data Backup Service

    • A Bash script that performs regular backups of station data to Amazon S3

Implementation Steps

  1. Set up AWS Environment

    • Provision an EC2 instance (Amazon Linux 2)
    • Configure VPC, security groups, and SSH access
  2. Install Docker

    • Write a Bash script to automate Docker installation on the EC2 instance
  3. Create Dockerfiles

    • Develop Dockerfiles for the Station Status Dashboard and Status API Service
    • Use multi-stage builds to optimize image sizes
  4. Develop Bash Scripts

    • Create the Resource Monitor script that sends metrics to CloudWatch
    • Write the Data Backup script, integrating with Amazon S3
  5. Docker Compose

    • Create a docker-compose.yml file to define and run the multi-container application
  6. Automation Script

    • Develop a master Bash script that:
      • Pulls the latest code from a Git repository
      • Builds Docker images
      • Starts the containers using Docker Compose
      • Initiates the Resource Monitor and Data Backup scripts
  7. Monitoring and Logging

    • Set up logging for all containers to Amazon CloudWatch Logs
    • Use Amazon CloudWatch for monitoring container health
  8. AWS Integration

    • Utilize Amazon S3 for storing backups
    • Implement Amazon SES for email alerts

Learning Outcomes

This project will provide hands-on experience with:

  • Linux system administration on EC2
  • Bash scripting for automation and system monitoring
  • Docker containerization and multi-container applications
  • AWS services (EC2, DynamoDB, S3, CloudWatch, SES)
  • Basic DevOps practices on AWS
  • Git for version control

Bonus Challenges

  1. Implement a Bash script to rotate logs and manage disk space
  2. Create a simple shell script to simulate different space station scenarios (e.g., low oxygen, power fluctuations) for testing the alert system
  3. Develop a Bash script to automate the process of updating SSL certificates for the Nginx server
  4. Write a script to perform automated backups of the DynamoDB table to S3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment