Skip to content

Local standalone implementation for mocking AWS Serverless Architecture E2E by using LocalStack offline AWS services emulator !!!

License

Notifications You must be signed in to change notification settings

elnickkx/lambda-exchange-tracker

Repository files navigation

lambda-exchange-tracker

Codebase for Lambda-based Currency Exchange application


  • Backend Server: AWS Lambda - Serverless Infrastructure
  • python3.11
  • Curated requirements.in [basic dependency libs]
  • Design Pattern followed: Creational-Singleton and Structural-Decorator Design Pattern
  • Architecture: Event-Driven Asynchronous Architecture

1. Steps for executing and hosting of application locally

Installation Guide for LocalStack support ecosystem

Installation Guide: https://docs.localstack.cloud/getting-started/installation/

Initiating the Localstack application server

localstack start # initialize

2. To setup the required AWS services locally via IaC and CDK

sudo chmod +x run_executor.sh
Run the command: /bin/bash run_executor.sh

3. Login to LocalStack Web-App to visualize the initiated services

Navigate to: `https://app.localstack.cloud/dashboard`

4. Architectural Design - Business Logic

diagram 1

  • Cloudwatch EventBridge
    • Event Rule defined to periodically trigger Lambda action to scrape the Currency Conversion (daily basis).
    • Once scraped, evaulate the fluctuated spot rate for enlisted currency for exchange and stored as time-series documents (NoSQL schema).

5. Manual Modular Testing

  • As to perform Modular Testing, execute the inline command: python3 worker_lambda.py
    • For EventBridge moderation: report_generation_cron_event as placeholder value
    • For APIGateway moderation: api_currency_exchange_event as placeholder value
  • Code Snippet:
    • class Context:
      
        invoked_function_arn = "test:dev"

        print(
            async_lambda_handler(
                event=events.api_currency_exchange_event, context=Context()
            )
        )

About

Local standalone implementation for mocking AWS Serverless Architecture E2E by using LocalStack offline AWS services emulator !!!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published