# rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end architecture

> Architecture diagram of the GitHub repository rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end
- Repository: https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end

## Overview

This repository implements a wine-quality SageMaker training and prediction workflow. Training can run either as an MLflow-enabled SageMaker pipeline or through a separate built-in XGBoost train-and-deploy script; a deployment script can also package the latest completed training artifact and create the prediction endpoint. The FastAPI application serves a form and forwards submitted features to that endpoint. The graph reflects the sampled source and README; the template’s behavior and deployment workflow details beyond the sampled deployment script are not independently verified.

Main entry points: [`scripts/train_with_mlflow.py`](https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/scripts/train_with_mlflow.py) (MLflow trainer), [`scripts/create_pipeline.py`](https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/scripts/create_pipeline.py) (Pipeline creator), [`deploy_latest_model.py`](https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/deploy_latest_model.py) (Latest model deployer), [`ml-api/app.py`](https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/ml-api/app.py) (Prediction API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Model training"]
  node_pipeline_creator["Pipeline creator<br/>[create_pipeline.py]"]
  node_mlflow_trainer["MLflow trainer"]
  node_direct_runner["Direct train runner"]
end

subgraph group_deployment["Endpoint deployment"]
  node_latest_deployer["Latest model deployer"]
end

subgraph group_serving["Prediction serving"]
  node_web_app["Prediction API<br/>[app.py]"]
  node_form_template["Prediction form<br/>[index.html]"]
end

subgraph group_cloud["AWS and tracking services"]
  node_s3[("S3 data and artifacts")]
  node_sagemaker["SageMaker"]
  node_mlflow[("MLflow tracking")]
end

node_user(("Wine user"))

node_user -->|"submits features"| node_web_app
node_web_app -->|"renders form"| node_form_template
node_web_app -->|"invokes endpoint"| node_sagemaker
node_pipeline_creator -->|"starts pipeline"| node_sagemaker
node_pipeline_creator -->|"configures training input"| node_s3
node_pipeline_creator -->|"sets training entrypoint"| node_mlflow_trainer
node_mlflow_trainer -->|"reads training channel"| node_s3
node_mlflow_trainer -.->|"logs runs"| node_mlflow
node_mlflow_trainer -->|"writes model artifact"| node_sagemaker
node_direct_runner -->|"converts dataset"| node_s3
node_direct_runner -->|"trains and deploys"| node_sagemaker
node_latest_deployer -->|"finds training job"| node_sagemaker
node_latest_deployer -->|"repackages artifact"| node_s3
node_latest_deployer -->|"creates endpoint"| node_sagemaker

click node_pipeline_creator "https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/scripts/create_pipeline.py"
click node_mlflow_trainer "https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/scripts/train_with_mlflow.py"
click node_direct_runner "https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/scripts/run_train_deploy.py"
click node_latest_deployer "https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/deploy_latest_model.py"
click node_web_app "https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/ml-api/app.py"
click node_form_template "https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/ml-api/templates/index.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pipeline_creator,node_mlflow_trainer,node_direct_runner,node_user toneBlue
class node_latest_deployer toneAmber
class node_web_app,node_form_template toneMint
class node_s3,node_sagemaker,node_mlflow toneRose
```

## Components

### Model training

- [Pipeline creator](https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/scripts/create_pipeline.py): `scripts/create_pipeline.py`
- [MLflow trainer](https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/scripts/train_with_mlflow.py): `scripts/train_with_mlflow.py`
- [Direct train runner](https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/scripts/run_train_deploy.py): `scripts/run_train_deploy.py`

### Endpoint deployment

- [Latest model deployer](https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/deploy_latest_model.py): `deploy_latest_model.py`

### Prediction serving

- [Prediction API](https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/ml-api/app.py): `ml-api/app.py`
- [Prediction form](https://github.com/rajinikanthvadla-ai/mlops-lab-02-aws-sagemaker-end-to-end/blob/main/ml-api/templates/index.html): `ml-api/templates/index.html`

### AWS and tracking services

- **S3 data and artifacts**
- **SageMaker**
- **MLflow tracking**

### Other components

- **Wine user**

## Connections

- Wine user → Prediction API: submits features (evidence: `ml-api/app.py`)
- Prediction API → Prediction form: renders form (evidence: `ml-api/app.py`)
- Prediction API → SageMaker: invokes endpoint (evidence: `ml-api/app.py`)
- Pipeline creator → SageMaker: starts pipeline (evidence: `scripts/create_pipeline.py`)
- Pipeline creator → S3 data and artifacts: configures training input (evidence: `scripts/create_pipeline.py`)
- Pipeline creator → MLflow trainer: sets training entrypoint (evidence: `scripts/create_pipeline.py`)
- MLflow trainer → S3 data and artifacts: reads training channel (evidence: `scripts/train_with_mlflow.py`)
- MLflow trainer → MLflow tracking: logs runs (evidence: `scripts/train_with_mlflow.py`)
- MLflow trainer → SageMaker: writes model artifact (evidence: `scripts/train_with_mlflow.py`)
- Direct train runner → S3 data and artifacts: converts dataset (evidence: `scripts/run_train_deploy.py`)
- Direct train runner → SageMaker: trains and deploys (evidence: `scripts/run_train_deploy.py`)
- Latest model deployer → SageMaker: finds training job (evidence: `deploy_latest_model.py`)
- Latest model deployer → S3 data and artifacts: repackages artifact (evidence: `deploy_latest_model.py`)
- Latest model deployer → SageMaker: creates endpoint (evidence: `deploy_latest_model.py`)
