Skip to content

About

Task list created with cdk

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

TaskChecklist Application

A secure, cloud-based task management application built with AWS CDK, Flask, and MySQL.

🚀 Overview

TaskChecklist is a full-stack web application that allows users to create, view, and manage tasks through a clean, responsive interface. The application is deployed on AWS using Infrastructure as Code (IaC) principles with AWS CDK.

✨ Features

  • Task Management: Add, view, and complete tasks with titles and descriptions
  • Responsive UI: Bootstrap-powered interface that works on all devices
  • Secure Architecture: Private subnets, security groups, and encrypted storage
  • Health Monitoring: Built-in health checks and ALB integration
  • Database Integration: MySQL RDS with automatic schema creation
  • Secrets Management: AWS Secrets Manager for secure credential handling

🏗️ Architecture

Internet → ALB → EC2 (Flask App) → RDS MySQL
                  ↓
              S3 Bucket (Assets)
                  ↓
           Secrets Manager (DB Credentials)

AWS Resources

  • VPC: Multi-AZ setup with public and private subnets
  • EC2: t3.micro instance running Flask application in private subnet
  • RDS: MySQL 8.0 database with encryption at rest
  • ALB: Application Load Balancer for high availability
  • S3: Encrypted bucket for application assets
  • Secrets Manager: Secure database credential storage
  • Security Groups: Restrictive network access controls

📋 Prerequisites

  • AWS CLI configured with appropriate permissions
  • Node.js 16+ (for AWS CDK CLI)
  • Python 3.7+
  • Git

Required AWS Permissions

Your AWS user/role needs permissions for:

  • EC2, RDS, VPC, ALB, S3, Secrets Manager
  • IAM role creation and policy attachment
  • CloudFormation stack operations

🛠️ Installation

  1. Clone the Repository

    git clone https://github.com/yourusername/taskchecklist.git
    cd taskchecklist
  2. Install AWS CDK CLI

    npm install -g aws-cdk
  3. Install Python Dependencies

    pip install -r requirements.txt
  4. Bootstrap CDK (first time only)

    cdk bootstrap
  5. Deploy the Stack

    cdk deploy

    The deployment will output the ALB DNS name for accessing your application.

📁 Project Structure

taskchecklist/
├── assets/
│   ├── app.py                 # Flask application
│   └── templates/
│       └── index.html         # Frontend interface
├── taskchecklist/
│   ├── __init__.py
│   └── taskchecklist_stack.py # CDK infrastructure definition
├── tests/
│   └── unit/
│       └── test_*.py          # Unit tests
├── app.py                     # CDK app entry point
├── cdk.json                   # CDK configuration
├── requirements.txt           # Python dependencies
└── README.md                  # This file

🔧 Configuration

Environment Variables (Set automatically by CDK)

  • DB_SECRET_NAME: ARN of the database secret in Secrets Manager
  • DB_HOST: RDS endpoint address
  • DB_NAME: Database name (taskchecklist)
  • AWS_REGION: AWS region (us-east-1)

Database Schema

The application automatically creates the following table:

CREATE TABLE tasks (
    id INT AUTO_INCREMENT PRIMARY KEY,
    title VARCHAR(255) NOT NULL,
    description TEXT,
    status ENUM('pending','completed') DEFAULT 'pending',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

🌐 API Endpoints

  • GET / - Main application interface
  • GET /health - Health check endpoint (used by ALB)
  • GET /tasks - Retrieve all tasks (JSON)
  • POST /tasks - Create a new task
  • POST /tasks/<id>/complete - Mark task as completed

🔒 Security Features

  • Network Security: Resources deployed in private subnets
  • Encryption: RDS and S3 encryption at rest
  • Access Control: Security groups with minimal required access
  • Secrets Management: Database credentials never stored in plain text
  • IAM Roles: Principle of least privilege for EC2 instance

📊 Monitoring & Troubleshooting

Health Checks

The ALB performs health checks on /health endpoint every 30 seconds.

Logs

  • Application Logs: /var/log/flask-start.log on EC2 instance
  • System Logs: /var/log/cloud-init-output.log for deployment issues
  • CloudWatch: EC2 and RDS metrics available in AWS console

Common Issues

  1. Instance Unhealthy: Check Flask app logs and ensure port 80 is accessible
  2. Database Connection: Verify RDS security group allows EC2 access
  3. Deployment Failures: Check CloudFormation events in AWS console

🧪 Testing

Run unit tests:

python -m pytest tests/

🚀 Deployment Process

  1. Assets Upload: Flask app files uploaded to S3
  2. Infrastructure: VPC, security groups, and networking created
  3. Database: RDS MySQL instance provisioned with encryption
  4. Compute: EC2 instance launched with user data script
  5. Application: Flask app downloaded, configured, and started
  6. Load Balancer: ALB configured with health checks

🔄 Updates

To update the application:

  1. Make changes to your code
  2. Run cdk deploy to update infrastructure
  3. For app-only changes, the EC2 instance will automatically pull updates

🧹 Cleanup

To remove all resources:

cdk destroy

⚠️ Warning: This will delete all data including the database!

📈 Scaling Considerations

Current setup is designed for development/small-scale use. For production:

  • Use Auto Scaling Groups for EC2 instances
  • Implement Multi-AZ RDS deployment
  • Add CloudFront for content delivery
  • Use ECS/Fargate for containerized deployment
  • Implement CI/CD pipeline

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • AWS CDK team for excellent Infrastructure as Code tools
  • Flask community for the lightweight web framework
  • Bootstrap for responsive UI components

Questions? Open an issue or contact the maintainers.

About

Task list created with cdk

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages