Skip to content

Adds the ability to have dynamic group members for subscriptions using Python , AWS, Terraform to Tableau

Notifications You must be signed in to change notification settings

2yan/Subscription-Manager

Repository files navigation

Subscription Manager

A serverless application for managing subscription groups using AWS Lambda functions.

Overview

Subscription Manager is a subscription management system that automates the process of subscribing users to Tableau reports based on their group memberships. The system consists of three main components:

Components

  1. Retool Frontend

    • User interface for managing subscription mappings
    • Allows administrators to:
      • Select groups and associate them with specific Tableau reports/views
      • Configure subscription schedules
      • Delete existing mappings
    • Provides a simple interface for maintaining group-to-report relationships
  2. Pull Data Lambda Function

    • Runs daily to synchronize Tableau data
    • Pulls comprehensive information from Tableau's REST API including:
      • All users
      • Available reports and views
      • Existing groups
      • Current subscription schedules
    • Updates the frontend with the latest Tableau metadata
  3. Subscribe Group Lambda Function

    • Executes daily to process subscription updates
    • Uses the mappings created in Retool to:
      • Subscribe users to reports based on their group memberships
      • Automatically handle new users added to groups
    • Note: Does not handle removal of subscriptions when users leave groups

Data Storage

The system uses a database to store:

  • Group-to-report mappings
  • Group names
  • Report names
  • Tableau metadata
  • Subscription schedules

Tableau API Configuration

The system uses the Tableau REST API with the following configuration:

  • SITE_CONTENT_URL: Set to empty string ("") to use the default site in Tableau Server. This is used when interacting with the main/default site rather than a specific site in a multi-site Tableau Server setup.

  • API_VERSION: Set to "3.23" to match the current Tableau Server version. This version supports:

Workflow

  1. Administrators use the Retool interface to create and manage group-to-report mappings
  2. The Pull Data Lambda function keeps the system updated with the latest Tableau information
  3. The Subscribe Group Lambda function processes these mappings daily to ensure users have the correct report subscriptions based on their group memberships

Project Structure

The project consists of two main Lambda functions:

  1. subscription_pull_data/ - Lambda function for pulling subscription data
  2. subscription_subscribe_group/ - Lambda function for managing subscription group operations

Infrastructure

The project uses Terraform for infrastructure as code, with the main configuration in main.tf. The infrastructure includes:

  • AWS Lambda functions
  • Associated IAM roles and permissions
  • Other AWS resources as needed

Development

Prerequisites

  • Python 3.x
  • AWS CLI configured with appropriate credentials
  • Terraform installed

Setup

  1. Clone the repository
  2. Install dependencies for each Lambda function:
    cd subscription_subscribe_group
    pip install -r requirements.txt

Testing

Each Lambda function includes its own test file:

  • test_lambda_function.py for testing the subscription group Lambda function

CI/CD

The project uses GitLab CI/CD for continuous integration and deployment, configured in .gitlab-ci.yml.

Contributing

  1. Create a new branch for your feature
  2. Make your changes
  3. Submit a merge request

About

Adds the ability to have dynamic group members for subscriptions using Python , AWS, Terraform to Tableau

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published