Skip to content

collection of serverless microservices deployed on AWS Lambda, featuring a web scraping service built with Python, Docker, and CI/CD pipelines.

Notifications You must be signed in to change notification settings

mvmendes/lambda-services

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Lambda Services Repository πŸš€

Repository for serverless microservices on AWS Lambda. Currently contains:

πŸ•·οΈ Web Scraping Microservice (/scrape-service)

Key Features

  • βœ… HTTP requests with redirect handling
  • βœ… HTML parsing with BeautifulSoup
  • βœ… Markdown conversion with link preservation
  • βœ… Image extraction with absolute URLs
  • βœ… Recursive link processing with depth control
  • βœ… PDF, DOCX and XLSX file processing
  • βœ… Link filtering via regex patterns
  • βœ… Docker/ZIP deployment
  • βœ… Function URL support
  • βœ… Cross-platform deployment scripts (PowerShell/Bash)

Quick Start

# Clone repository
git clone https://github.com/mvmendes/lambda-services.git
cd lambda-services/scrape-service

# Configure AWS credentials (if not already done)
aws configure

# Set environment variables (optional)
export AWS_PROFILE="your-profile"    # Default: "default"
export AWS_REGION="sa-east-1"        # Default: "us-east-1"
export LAMBDA_FUNCTION="ScrapeService"

# Deploy (Linux/MacOS)
chmod +x build_and_deploy.sh
./build_and_deploy.sh

# OR Deploy (Windows PowerShell)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
.\build_and_deploy.ps1

Project Structure

scrape-service/
β”œβ”€β”€ src/                    # Core source code
β”‚   └── scrape_lambda.py    # Lambda handler
β”œβ”€β”€ test/                   # Automated tests
β”œβ”€β”€ Dockerfile              # Container config
β”œβ”€β”€ build_and_deploy.sh     # Linux/MacOS deployment
β”œβ”€β”€ build_and_deploy.ps1     # Windows deployment
β”œβ”€β”€ requirements.txt        # Python dependencies
└── README.md              # Service documentation

Detailed Service Guide

πŸ”§ Core Technologies

  • AWS Lambda - Serverless execution
  • Python 3.12 - Core logic
  • Docker - Container packaging
  • BeautifulSoup - HTML parsing
  • Pytest - Automated testing
  • PowerShell/Bash - Cross-platform deployment

πŸ“¦ Repository Structure

Each service directory contains:

  • Source code
  • Cross-platform deployment scripts
  • Dockerfile for container deployment
  • Service-specific documentation
  • Unit tests
  • Requirements file

πŸ” Required AWS Permissions

The deployment user needs these permissions:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "lambda:CreateFunction",
                "lambda:UpdateFunctionCode",
                "lambda:GetFunction",
                "lambda:CreateFunctionUrlConfig",
                "lambda:AddPermission",
                "logs:CreateLogGroup",
                "logs:CreateLogStream",
                "logs:PutLogEvents"
            ],
            "Resource": [
                "arn:aws:lambda:*:*:function:ScrapeService*",
                "arn:aws:logs:*:*:log-group:/aws/lambda/ScrapeService*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "iam:PassRole",
                "iam:CreateRole",
                "iam:GetRole",
                "iam:AttachRolePolicy"
            ],
            "Resource": "arn:aws:iam::*:role/lambda-scrape-service-role"
        }
    ]
}

🀝 Contribution

  1. Fork repository
  2. Create feature branch (git checkout -b feature/fooBar)
  3. Commit changes (git commit -am 'Add fooBar')
  4. Push branch (git push origin feature/fooBar)
  5. Open Pull Request

πŸ“„ License

MIT License - See LICENSE


Next Steps: Ready to add new microservices following the same structure.

About

collection of serverless microservices deployed on AWS Lambda, featuring a web scraping service built with Python, Docker, and CI/CD pipelines.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages