# aws-samples/mlops-sagemaker-github-actions architecture

> Architecture diagram of the GitHub repository aws-samples/mlops-sagemaker-github-actions, 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/aws-samples/mlops-sagemaker-github-actions
- Repository: https://github.com/aws-samples/mlops-sagemaker-github-actions

## Overview

This repository is an AWS SageMaker/GitHub Actions MLOps example. Its central workflow builds and evaluates an Abalone model, registers it, then prepares staging and production deployments, with production gated by approval. The seedcode pipeline CLI dynamically loads a pipeline module; deployment configuration selects an approved package, and stack deployment applies stage parameters. The root Lambda triggers a GitHub deployment workflow using a token from Secrets Manager. The pipeline definition and GitHub workflow internals were not sampled, so documented capability links use the README and implementation detail is limited to shown code.

Main entry points: [`seedcode/build_deployment_configs.py`](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/build_deployment_configs.py) (Stage config builder), [`seedcode/pipelines/abalone/pipeline.py`](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/abalone/pipeline.py) (Abalone pipeline), [`seedcode/deploy_stack.py`](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/deploy_stack.py) (Stack deployer), [`seedcode/.github/workflows`](https://github.com/aws-samples/mlops-sagemaker-github-actions/tree/main/seedcode/.github/workflows) (GitHub Actions workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model_pipeline["Model pipeline"]
  node_run_cli["Run pipeline CLI<br/>[run_pipeline.py]"]
  node_pipeline_utils["Pipeline utilities<br/>[_utils.py]"]
  node_pipeline_def["Abalone pipeline<br/>[pipeline.py]"]
  node_prep["Prepare data<br/>[preprocess.py]"]
  node_train["Train model<br/>[pipeline.py]"]
  node_evaluate["Evaluate model<br/>[evaluate.py]"]
  node_registry[("Model Registry")]
  node_get_definition["Definition CLI"]
end

subgraph group_deploy["Deployment"]
  node_config_builder["Stage config builder"]
  node_stage_configs["Stage configurations"]
  node_prod_configs["Production configuration<br/>[prod-config.json]"]
  node_stack_deployer["Stack deployer<br/>[deploy_stack.py]"]
  node_endpoint_template["Endpoint stack template"]
  node_project_template["SageMaker project template<br/>[template.yml]"]
end

subgraph group_automation["GitHub automation"]
  node_lambda_trigger["Workflow trigger Lambda<br/>[lambda_function.py]"]
  node_github_workflow["GitHub Actions workflows<br/>[workflows]"]
end

node_developer(("Project operator"))
node_github(("GitHub"))
node_secrets[("AWS Secrets Manager")]
node_sagemaker["Amazon SageMaker"]
node_cloudformation["AWS CloudFormation"]
node_approval(("Production reviewer"))

node_developer -->|"runs"| node_run_cli
node_run_cli -->|"loads driver"| node_pipeline_utils
node_get_definition -->|"loads driver"| node_pipeline_utils
node_pipeline_utils -->|"imports module"| node_pipeline_def
node_run_cli -->|"upserts and starts"| node_sagemaker
node_pipeline_def -->|"runs preparation"| node_prep
node_pipeline_def -->|"trains model"| node_train
node_pipeline_def -->|"evaluates model"| node_evaluate
node_pipeline_def -->|"registers model"| node_registry
node_config_builder -->|"selects approved model"| node_registry
node_config_builder -->|"reads staging settings"| node_stage_configs
node_config_builder -->|"reads production settings"| node_prod_configs
node_config_builder -->|"queries project and package"| node_sagemaker
node_config_builder -.->|"provides stage parameters"| node_stack_deployer
node_stack_deployer -->|"loads template"| node_endpoint_template
node_stack_deployer -->|"creates or updates"| node_cloudformation
node_project_template -.->|"provisions trigger"| node_lambda_trigger
node_project_template -.->|"configures integration"| node_github_workflow
node_approval -->|"approves production"| node_github_workflow
node_github_workflow -.->|"prepares deployment"| node_config_builder
node_github_workflow -.->|"deploys stages"| node_stack_deployer
node_lambda_trigger -->|"reads token"| node_secrets
node_lambda_trigger -->|"dispatches workflow"| node_github

click node_run_cli "https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/run_pipeline.py"
click node_pipeline_utils "https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/_utils.py"
click node_pipeline_def "https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/abalone/pipeline.py"
click node_prep "https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/abalone/preprocess.py"
click node_train "https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/abalone/pipeline.py"
click node_evaluate "https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/abalone/evaluate.py"
click node_get_definition "https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/get_pipeline_definition.py"
click node_config_builder "https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/build_deployment_configs.py"
click node_stage_configs "https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/staging-config.json"
click node_prod_configs "https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/prod-config.json"
click node_stack_deployer "https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/deploy_stack.py"
click node_endpoint_template "https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/endpoint-config-template.yml"
click node_project_template "https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/project/template.yml"
click node_lambda_trigger "https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/lambda_functions/lambda_github_workflow_trigger/lambda_function.py"
click node_github_workflow "https://github.com/aws-samples/mlops-sagemaker-github-actions/tree/main/seedcode/.github/workflows"

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_run_cli,node_pipeline_utils,node_pipeline_def,node_prep,node_train,node_evaluate,node_registry,node_get_definition,node_approval toneBlue
class node_config_builder,node_stage_configs,node_prod_configs,node_stack_deployer,node_endpoint_template,node_project_template,node_secrets toneAmber
class node_lambda_trigger,node_github_workflow toneMint
class node_developer,node_github,node_sagemaker,node_cloudformation toneIndigo
```

## Components

### Model pipeline

- [Run pipeline CLI](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/run_pipeline.py): `seedcode/pipelines/run_pipeline.py`
- [Pipeline utilities](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/_utils.py): `seedcode/pipelines/_utils.py`
- [Abalone pipeline](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/abalone/pipeline.py): `seedcode/pipelines/abalone/pipeline.py`
- [Prepare data](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/abalone/preprocess.py): `seedcode/pipelines/abalone/preprocess.py`
- [Train model](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/abalone/pipeline.py): `seedcode/pipelines/abalone/pipeline.py`
- [Evaluate model](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/abalone/evaluate.py): `seedcode/pipelines/abalone/evaluate.py`
- **Model Registry**
- [Definition CLI](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/pipelines/get_pipeline_definition.py): `seedcode/pipelines/get_pipeline_definition.py`

### Deployment

- [Stage config builder](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/build_deployment_configs.py): `seedcode/build_deployment_configs.py`
- [Stage configurations](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/staging-config.json): `seedcode/staging-config.json`
- [Production configuration](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/prod-config.json): `seedcode/prod-config.json`
- [Stack deployer](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/deploy_stack.py): `seedcode/deploy_stack.py`
- [Endpoint stack template](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/seedcode/endpoint-config-template.yml): `seedcode/endpoint-config-template.yml`
- [SageMaker project template](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/project/template.yml): `project/template.yml`

### GitHub automation

- [Workflow trigger Lambda](https://github.com/aws-samples/mlops-sagemaker-github-actions/blob/main/lambda_functions/lambda_github_workflow_trigger/lambda_function.py): `lambda_functions/lambda_github_workflow_trigger/lambda_function.py`
- [GitHub Actions workflows](https://github.com/aws-samples/mlops-sagemaker-github-actions/tree/main/seedcode/.github/workflows): `seedcode/.github/workflows`

### Other components

- **Project operator**
- **GitHub**
- **AWS Secrets Manager**
- **Amazon SageMaker**
- **AWS CloudFormation**
- **Production reviewer**

## Connections

- Project operator → Run pipeline CLI: runs (evidence: `README.md`)
- Run pipeline CLI → Pipeline utilities: loads driver (evidence: `seedcode/pipelines/run_pipeline.py`)
- Definition CLI → Pipeline utilities: loads driver (evidence: `seedcode/pipelines/get_pipeline_definition.py`)
- Pipeline utilities → Abalone pipeline: imports module (evidence: `seedcode/pipelines/_utils.py`)
- Run pipeline CLI → Amazon SageMaker: upserts and starts (evidence: `seedcode/pipelines/run_pipeline.py`)
- Abalone pipeline → Prepare data: runs preparation (evidence: `README.md`)
- Abalone pipeline → Train model: trains model (evidence: `README.md`)
- Abalone pipeline → Evaluate model: evaluates model (evidence: `README.md`)
- Abalone pipeline → Model Registry: registers model (evidence: `README.md`)
- Stage config builder → Model Registry: selects approved model (evidence: `seedcode/build_deployment_configs.py`)
- Stage config builder → Stage configurations: reads staging settings (evidence: `seedcode/build_deployment_configs.py`)
- Stage config builder → Production configuration: reads production settings (evidence: `seedcode/build_deployment_configs.py`)
- Stage config builder → Amazon SageMaker: queries project and package (evidence: `seedcode/build_deployment_configs.py`)
- Stage config builder → Stack deployer: provides stage parameters (evidence: `README.md`)
- Stack deployer → Endpoint stack template: loads template (evidence: `seedcode/deploy_stack.py`)
- Stack deployer → AWS CloudFormation: creates or updates (evidence: `seedcode/deploy_stack.py`)
- SageMaker project template → Workflow trigger Lambda: provisions trigger (evidence: `README.md`)
- SageMaker project template → GitHub Actions workflows: configures integration (evidence: `README.md`)
- Production reviewer → GitHub Actions workflows: approves production (evidence: `README.md`)
- GitHub Actions workflows → Stage config builder: prepares deployment (evidence: `README.md`)
- GitHub Actions workflows → Stack deployer: deploys stages (evidence: `README.md`)
- Workflow trigger Lambda → AWS Secrets Manager: reads token (evidence: `lambda_functions/lambda_github_workflow_trigger/lambda_function.py`)
- Workflow trigger Lambda → GitHub: dispatches workflow (evidence: `lambda_functions/lambda_github_workflow_trigger/lambda_function.py`)
