Skip to content

Latest commit

 

History

History
1239 lines (1009 loc) · 60.1 KB

File metadata and controls

1239 lines (1009 loc) · 60.1 KB

en pt fr it ja zh he

Back to Main README

CLI du Pipeline CI/CD SMUS

[Domaines IAM + IdC] Ce CLI prend en charge les domaines SMUS basés sur IAM et sur IAM Identity Center (IdC). Pour les domaines IdC, une configuration supplémentaire (réseau VPC, permissions Lake Formation, politiques IAM en ligne) peut être nécessaire — consultez les scripts de configuration dans chaque répertoire d'exemple.

Automatisez le déploiement d'applications de données dans les environnements SageMaker Unified Studio

Déployez des DAG Airflow, des notebooks Jupyter et des workflows ML du développement à la production en toute confiance. Conçu pour les data scientists, les data engineers, les ML engineers et les développeurs d'applications GenAI travaillant avec les équipes DevOps.

Fonctionne avec votre stratégie de déploiement : Que vous utilisiez des branches git (basé sur les branches), des artefacts versionnés (basé sur les bundles), des tags git (basé sur les tags) ou un déploiement direct - ce CLI prend en charge votre workflow. Définissez votre application une fois, déployez-la à votre manière.


Pourquoi SMUS CI/CD CLI ?

Couche d'abstraction AWS - Le CLI encapsule toute la complexité d'AWS analytics, ML et SMUS - Les équipes DevOps n'appellent jamais directement les API AWS
Séparation des préoccupations - Les équipes data définissent QUOI déployer (manifest.yaml), les équipes DevOps définissent COMMENT et QUAND (workflows CI/CD)
Workflows CI/CD génériques - Le même workflow fonctionne pour Glue, SageMaker, Bedrock, QuickSight, ou toute combinaison de services AWS
Déployer en toute confiance - Validation par simulation pré-déploiement et tests automatisés avant la production
Gestion multi-environnements - Test → Prod avec configuration spécifique à chaque environnement
Infrastructure as Code - Manifestes d'application versionnés et déploiements reproductibles
Workflows événementiels - Déclencher automatiquement des workflows via EventBridge lors du déploiement


Démarrage rapide

Installation :

pip install aws-smus-cicd-cli

Déployez votre première application :

# Valider la configuration
aws-smus-cicd-cli describe --manifest manifest.yaml --connect

# Créer un bundle de déploiement (optionnel)
aws-smus-cicd-cli bundle --manifest manifest.yaml

# Prévisualiser le déploiement (exécution à blanc)
aws-smus-cicd-cli deploy --targets test --manifest manifest.yaml --dry-run

# Déployer vers l'environnement de test
aws-smus-cicd-cli deploy --targets test --manifest manifest.yaml

# Exécuter les tests de validation
aws-smus-cicd-cli test --manifest manifest.yaml --targets test

# Nettoyer une fois terminé
aws-smus-cicd-cli destroy --manifest manifest.yaml --targets test --force

Voir en action : Exemple GitHub Actions en direct


À Qui S'Adresse Ceci ?

👨‍💻 Équipes Data (Data Scientists, Data Engineers, Développeurs d'Applications GenAI)

Vous vous concentrez sur : Votre application - quoi déployer, où déployer et comment elle s'exécute
Vous définissez : Le manifeste d'application (manifest.yaml) avec votre code, workflows et configurations
Vous n'avez pas besoin de connaître : Les pipelines CI/CD, GitHub Actions, l'automatisation du déploiement

Guide de Démarrage Rapide - Déployez votre première application en 10 minutes

Inclut des exemples pour :

  • Data Engineering (Glue, Notebooks, Athena)
  • Workflows ML (SageMaker, Notebooks)
  • Applications GenAI (Bedrock, Notebooks)

🔧 Équipes DevOps

Vous vous concentrez sur : Les bonnes pratiques CI/CD, la sécurité, la conformité et l'automatisation du déploiement
Vous définissez : Des modèles de workflow qui imposent des tests, des approbations et des politiques de promotion
Vous n'avez pas besoin de connaître : Les détails spécifiques aux applications, les services AWS utilisés, les API DataZone, les structures de projet SMUS ou la logique métier

Guide Administrateur - Configurez l'infrastructure et les pipelines en 15 minutes
Modèles de Workflow GitHub - Modèles de workflow génériques et réutilisables pour le déploiement automatisé

Le CLI est votre couche d'abstraction : Vous appelez simplement aws-smus-cicd-cli deploy - le CLI gère toutes les interactions avec les services AWS (DataZone, Glue, Athena, SageMaker, MWAA, S3, IAM, etc.). Vos workflows restent simples et génériques.


Que pouvez-vous déployer ?

📊 Analytique & BI

  • Tâches ETL et crawlers Glue
  • Requêtes Athena
  • Tableaux de bord QuickSight
  • Tâches EMR (futur)
  • Requêtes Redshift (futur)

🤖 Machine Learning

  • Tâches d'entraînement SageMaker
  • Modèles ML et points de terminaison
  • Expériences MLflow
  • Feature Store (futur)
  • Transformations par lot (futur)

🧠 IA générative

  • Agents Bedrock
  • Bases de connaissances
  • Configurations de modèles de fondation (futur)

📓 Code & Workflows

  • Notebooks Jupyter
  • Scripts Python
  • DAG Airflow (MWAA et Amazon MWAA Serverless)
  • Fonctions Lambda (futur)

💾 Données & Stockage

  • Fichiers de données S3
  • Dépôts Git
  • Ressources de catalogue DataZone (Glossaires, GlossaryTerms, FormTypes, AssetTypes, Assets, Data Products, Metadata Forms)

Services AWS pris en charge

Déployez des workflows en utilisant ces services AWS via la syntaxe YAML Airflow :

🎯 Analytique et données

Amazon AthenaAWS GlueAmazon EMRAmazon RedshiftAmazon QuickSightLake Formation

🤖 Machine Learning

SageMaker TrainingSageMaker PipelinesFeature StoreModel RegistryBatch Transform

🧠 IA générative

Amazon BedrockBedrock AgentsBedrock Knowledge BasesGuardrails

📊 Services supplémentaires

S3 • Lambda • Step Functions • DynamoDB • RDS • SNS/SQS • Batch

Voir la liste complète : Référence des opérateurs AWS Airflow


Concepts fondamentaux

Séparation des préoccupations : Le principe de conception clé

Le problème : Les approches de déploiement traditionnelles obligent les équipes DevOps à apprendre les services d'analyse AWS (Glue, Athena, DataZone, SageMaker, MWAA, etc.) et à comprendre les structures de projet SMUS, ou obligent les équipes de données à devenir des experts CI/CD.

La solution : SMUS CI/CD CLI est la couche d'abstraction qui encapsule toute la complexité AWS et SMUS.

Exemple de flux de travail :

1. Équipe DevOps               2. Équipe de données            3. SMUS CI/CD CLI (L'abstraction)
   ↓                               ↓                              ↓
Définit le PROCESSUS           Définit le CONTENU             Le workflow appelle :
- Test lors du merge           - Jobs Glue                    aws-smus-cicd-cli deploy --manifest manifest.yaml
- Approbation pour prod        - Entraînement SageMaker         ↓
- Analyses de sécurité         - Requêtes Athena              Le CLI gère TOUTE la complexité AWS :
- Règles de notification       - Structure de fichiers        - APIs DataZone
                                                              - APIs Glue/Athena/SageMaker
Définit l'INFRASTRUCTURE                                      - Déploiement MWAA
- Compte et région                                            - Gestion S3
- Rôles IAM                                                   - Configuration IAM
- Ressources                                                  - Provisionnement d'infrastructure

Fonctionne pour N'IMPORTE quelle app !
Aucune connaissance des services
ML/Analytics/GenAI nécessaire !

Les équipes DevOps se concentrent sur :

  • Les bonnes pratiques CI/CD (tests, approbations, notifications)
  • Les contrôles de sécurité et de conformité
  • L'orchestration des déploiements
  • La surveillance et les alertes

SMUS CI/CD CLI gère TOUTE la complexité AWS :

  • Gestion des domaines et projets DataZone
  • APIs AWS Glue, Athena, SageMaker, MWAA
  • Gestion du stockage S3 et des artefacts
  • Rôles et permissions IAM
  • Configurations de connexion
  • Abonnements aux actifs du catalogue
  • Déploiement des workflows vers Airflow
  • Provisionnement d'infrastructure
  • Tests et validation

Les équipes de données se concentrent sur :

  • Le code applicatif et les workflows
  • Les services AWS à utiliser (Glue, Athena, SageMaker, etc.)
  • Les configurations d'environnement
  • La logique métier

Résultat :

  • Les équipes DevOps n'appellent jamais directement les APIs AWS - elles appellent simplement aws-smus-cicd-cli deploy
  • Les workflows CI/CD sont génériques - le même workflow fonctionne pour les applications Glue, SageMaker ou Bedrock
  • Les équipes de données ne touchent jamais aux configurations CI/CD
  • Les deux équipes travaillent de manière indépendante en utilisant leur expertise

Manifeste d'application

Un fichier YAML déclaratif (manifest.yaml) qui définit votre application de données :

  • Détails de l'application - Nom, version, description
  • Contenu - Code provenant de dépôts git, données/modèles provenant du stockage, tableaux de bord QuickSight
  • Workflows - DAGs Airflow pour l'orchestration et l'automatisation
  • Stages - Où déployer (environnements dev, test, prod)
  • Configuration - Paramètres spécifiques à l'environnement, connexions et actions de bootstrap

Créé et détenu par les équipes de données. Définit quoi déployer et . Aucune connaissance CI/CD requise.

Application

Votre charge de travail de données/analyse en cours de déploiement :

  • DAGs Airflow et scripts Python
  • Notebooks Jupyter et fichiers de données
  • Modèles ML et code d'entraînement
  • Pipelines ETL et transformations
  • Agents GenAI et serveurs MCP
  • Configurations de modèles de fondation

Stage

Un environnement de déploiement (dev, test, prod) mappé à un projet SageMaker Unified Studio :

  • Configuration du domaine et de la région
  • Nom et paramètres du projet
  • Connexions aux ressources (S3, Airflow, Athena, Glue)
  • Paramètres spécifiques à l'environnement
  • Mappage de branche optionnel pour les déploiements basés sur git

Mappage Stage vers Projet

Chaque stage d'application se déploie vers un projet SageMaker Unified Studio (SMUS) dédié. Un projet peut héberger une seule application ou plusieurs applications selon votre architecture et votre méthodologie CI/CD. Les projets de stage sont des entités indépendantes avec leur propre gouvernance :

  • Propriété et accès : Chaque projet de stage possède son propre ensemble de propriétaires et de contributeurs, qui peuvent différer du projet de développement. Les projets de production ont généralement un accès restreint par rapport aux environnements de développement.
  • Multi-domaines et multi-régions : Les projets de stage peuvent appartenir à différents domaines SMUS, comptes AWS et régions. Par exemple, votre stage dev peut se déployer vers un domaine de développement dans us-east-1, tandis que prod se déploie vers un domaine de production dans eu-west-1.
  • Architecture flexible : Les organisations peuvent choisir entre des projets dédiés par application (isolation) ou des projets partagés hébergeant plusieurs applications (consolidation), en fonction des exigences de sécurité, de conformité et opérationnelles.

Cette séparation permet une véritable isolation des environnements avec des contrôles d'accès indépendants, des limites de conformité et des exigences de résidence des données régionales.

Workflow

Logique d'orchestration qui exécute votre application. Les workflows servent deux objectifs :

1. Au moment du déploiement : Créer les ressources AWS requises pendant le déploiement

  • Provisionner l'infrastructure (buckets S3, bases de données, rôles IAM)
  • Configurer les connexions et les permissions
  • Mettre en place la surveillance et la journalisation

2. À l'exécution : Exécuter les pipelines de données et ML en continu

  • Exécution planifiée (quotidienne, horaire, etc.)
  • Déclencheurs basés sur des événements (uploads S3, appels API)
  • Traitement et transformations de données
  • Entraînement et inférence de modèles

Les workflows sont définis comme des DAGs Airflow (Directed Acyclic Graphs) au format YAML. Prend en charge MWAA (Managed Workflows for Apache Airflow) et Amazon MWAA Serverless (Guide utilisateur).

Automatisation CI/CD

Workflows GitHub Actions (ou autres systèmes CI/CD) qui automatisent le déploiement :

  • Créés et détenus par les équipes DevOps
  • Définit comment et quand déployer
  • Exécute les tests et les contrôles qualité
  • Gère la promotion entre les cibles
  • Applique les politiques de sécurité et de conformité
  • Exemple : .github/workflows/deploy.yml

Point clé : Les équipes DevOps créent des workflows génériques et réutilisables qui fonctionnent pour N'IMPORTE quelle application. Elles n'ont pas besoin de savoir si l'application utilise Glue, SageMaker ou Bedrock - le CLI gère toutes les interactions avec les services AWS. Le workflow appelle simplement aws-smus-cicd-cli deploy et le CLI fait le reste.

Modes de déploiement

Basé sur bundle (Artefact) : Créer une archive versionnée → déployer l'archive vers les stages

  • Bon pour : pistes d'audit, capacité de rollback, conformité
  • Commande : aws-smus-cicd-cli bundle puis aws-smus-cicd-cli deploy --manifest app.tar.gz

Direct (Basé sur Git) : Déployer directement depuis les sources sans artefacts intermédiaires

  • Bon pour : workflows plus simples, itération rapide, git comme source de vérité
  • Commande : aws-smus-cicd-cli deploy --manifest manifest.yaml --targets test

Les deux modes fonctionnent avec n'importe quelle combinaison de sources de contenu de stockage et git.


Example Applications

Real-world examples showing how to deploy different workloads with SMUS CI/CD.

📊 Analytics - QuickSight Dashboard

Deploy interactive BI dashboards with automated Glue ETL pipelines for data preparation. Uses QuickSight asset bundles, Athena queries, and GitHub dataset integration with environment-specific configurations.

AWS Services: QuickSight • Glue • Athena • S3 • MWAA Serverless

GitHub Workflow: analytic-dashboard-glue-quicksight.yml

What happens during deployment: Application code is deployed to S3, Glue jobs and Airflow workflows are created and executed, QuickSight dashboard/data source/dataset are created, and QuickSight ingestion is initiated to refresh the dashboard with latest data.

📁 App Structure
dashboard-glue-quick/
├── manifest.yaml                      # Deployment configuration
├── covid_etl_workflow.yaml           # Airflow workflow definition
├── glue_setup_covid_db.py            # Glue job: Create database & tables
├── glue_covid_summary_job.py         # Glue job: ETL transformations
├── glue_set_permission_check.py      # Glue job: Permission validation
├── quicksight/
│   └── TotalDeathByCountry.qs        # QuickSight dashboard bundle
└── app_tests/
    └── test_covid_data.py            # Integration tests

Key Files:

  • Glue Jobs: Python scripts for database setup, ETL, and validation
  • Workflow: YAML defining Airflow DAG for orchestration
  • QuickSight Bundle: Dashboard, datasets, and data sources
  • Tests: Validate data quality and dashboard functionality
View Airflow Workflow
workflow_combined:
  dag_id: 'covid_dashboard_glue_quick_pipeline'
  tasks:
    setup_covid_db_task:
      operator: airflow.providers.amazon.aws.operators.glue.GlueJobOperator
      retries: 0
      job_name: setup-covid-db-job
      script_location: '{proj.connection.default.s3_shared.s3Uri}dashboard-glue-quick/bundle/glue_setup_covid_db.py'
      s3_bucket: '{proj.connection.default.s3_shared.bucket}'
      iam_role_name: '{proj.iam_role_name}'
      region_name: '{domain.region}'
      update_config: true
      script_args:
        '--BUCKET_NAME': '{proj.connection.default.s3_shared.bucket}'
        '--REGION_NAME': '{domain.region}'
      create_job_kwargs:
        GlueVersion: '4.0'
        MaxRetries: 0
        Timeout: 180

    data_summary_task:
      operator: airflow.providers.amazon.aws.operators.glue.GlueJobOperator
      retries: 0
      job_name: summary-glue-job
      script_location: '{proj.connection.default.s3_shared.s3Uri}dashboard-glue-quick/bundle/glue_covid_summary_job.py'
      s3_bucket: '{proj.connection.default.s3_shared.bucket}'
      iam_role_name: '{proj.iam_role_name}'
      region_name: '{domain.region}'
      update_config: true
      script_args:
        '--DATABASE_NAME': 'covid19_db'
        '--TABLE_NAME': 'us_simplified'
        '--SUMMARY_DATABASE_NAME': 'covid19_summary_db'
        '--S3_DATABASE_PATH': '{proj.connection.default.s3_shared.s3Uri}dashboard-glue-quick/output/databases/covid19_summary_db/'
        '--BUCKET_NAME': '{proj.connection.default.s3_shared.bucket}'
      dependencies: [setup_covid_db_task]
      create_job_kwargs:
        GlueVersion: '4.0'
        MaxRetries: 0
        Timeout: 180

    set_permission_check_task:
      operator: airflow.providers.amazon.aws.operators.glue.GlueJobOperator
      retries: 0
      job_name: set-permission-check-job
      script_location: '{proj.connection.default.s3_shared.s3Uri}dashboard-glue-quick/bundle/glue_set_permission_check.py'
      s3_bucket: '{proj.connection.default.s3_shared.bucket}'
      iam_role_name: '{proj.iam_role_name}'
      region_name: '{domain.region}'
      update_config: true
      script_args:
        '--BUCKET_NAME': '{proj.connection.default.s3_shared.bucket}'
        '--REGION_NAME': '{domain.region}'
        '--ROLES': '{env.GRANT_TO}'
      dependencies: [data_summary_task]
      create_job_kwargs:
        GlueVersion: '4.0'
        MaxRetries: 0
        Timeout: 180
View Manifest
applicationName: IntegrationTestETLWorkflow

content:
  storage:
  - name: dashboard-glue-quick
    include:
    - "*.py"
  - name: workflows
    include:
    - "*.yaml"
  
  git:
  - repository: covid-19-dataset
    url: https://github.com/datasets/covid-19.git
  
  quicksight:
  - name: TotalDeathByCountry
    type: dashboard
  
  workflows:
  - workflowName: covid_dashboard_glue_quick_pipeline
    connectionName: default.workflow_serverless

stages:
  test:
    stage: TEST
    domain:
      tags:
        purpose: smus-cicd-testing
      region: ${TEST_DOMAIN_REGION}
    project:
      name: test-marketing
      owners:
      - Eng1
      - arn:aws:iam::${AWS_ACCOUNT_ID}:role/GitHubActionsRole-SMUS-CLI-Tests
      - arn:aws:iam::${AWS_ACCOUNT_ID}:role/Admin
    environment_variables:
      S3_PREFIX: test
      AWS_REGION: ${TEST_DOMAIN_REGION}
      GRANT_TO: Admin,service-role/aws-quicksight-service-role-v0
    bootstrap:
      actions:
      - type: workflow.create
        workflowName: covid_dashboard_glue_quick_pipeline
      - type: workflow.run
        workflowName: covid_dashboard_glue_quick_pipeline
        trailLogs: true
      - type: quicksight.refresh_dataset
        refreshScope: IMPORTED
        ingestionType: FULL_REFRESH
        wait: false
    deployment_configuration:
      storage:
      - name: dashboard-glue-quick
        connectionName: default.s3_shared
        targetDirectory: dashboard-glue-quick/bundle
      - name: workflows
        connectionName: default.s3_shared
        targetDirectory: dashboard-glue-quick/bundle/workflows
      git:
      - name: covid-19-dataset
        connectionName: default.s3_shared
        targetDirectory: repos
      quicksight:
        assets:
        - name: TotalDeathByCountry
          owners:
          - arn:aws:quicksight:${TEST_DOMAIN_REGION}:${AWS_ACCOUNT_ID}:user/default/Admin/*
          viewers:
          - arn:aws:quicksight:${TEST_DOMAIN_REGION}:${AWS_ACCOUNT_ID}:user/default/Admin/*
        overrideParameters:
          ResourceIdOverrideConfiguration:
            PrefixForAllResources: deployed-{stage.name}-covid-

View Full Example →


📓 Data Engineering - Notebooks

Deploy Jupyter notebooks with parallel execution orchestration for data analysis and ETL workflows. Demonstrates notebook deployment with MLflow integration for experiment tracking.

AWS Services: SageMaker Notebooks • MLflow • S3 • MWAA Serverless

GitHub Workflow: analytic-data-notebooks.yml

What happens during deployment: Notebooks and workflow definitions are uploaded to S3, Airflow DAG is created for parallel notebook execution, MLflow connection is provisioned for experiment tracking, and notebooks are ready to run on-demand or scheduled.

📁 App Structure
data-notebooks/
├── manifest.yaml                                # Deployment configuration
├── notebooks/
│   ├── customer_churn_prediction.ipynb         # Customer churn ML
│   ├── retail_sales_forecasting.ipynb          # Sales forecasting
│   ├── customer_segmentation_analysis.ipynb    # Customer segmentation
│   └── requirements.txt                        # Python dependencies
├── workflows/
│   └── parallel_notebooks_workflow.yaml        # Airflow orchestration
└── app_tests/
    └── test_notebooks_execution.py             # Integration tests

Key Files:

  • Notebooks: 3 Jupyter notebooks for ML and analytics workflows
  • Workflow: Parallel execution orchestration with Airflow
  • Tests: Validate notebook execution and outputs
View Manifest
applicationName: IntegrationTestNotebooks

content:
  storage:
    - name: notebooks
      connectionName: default.s3_shared
      include:
        - notebooks/
        - workflows/
  
  workflows:
    - workflowName: parallel_notebooks_execution
      connectionName: default.workflow_serverless

stages:
  test:
    domain:
      region: us-east-1
    project:
      name: test-marketing
      owners:
        - Eng1
        - arn:aws:iam::${AWS_ACCOUNT_ID}:role/GitHubActionsRole-SMUS-CLI-Tests
    environment_variables:
      S3_PREFIX: test
    deployment_configuration:
      storage:
        - name: notebooks
          connectionName: default.s3_shared
          targetDirectory: notebooks/bundle/notebooks
    bootstrap:
      actions:
        - type: datazone.create_connection
          name: mlflow-server
          connection_type: MLFLOW
          properties:
            trackingServerArn: arn:aws:sagemaker:${TEST_DOMAIN_REGION}:${AWS_ACCOUNT_ID}:mlflow-tracking-server/smus-integration-mlflow-use2
            trackingServerName: smus-integration-mlflow-use2
        - type: workflow.create
          workflowName: parallel_notebooks_execution
        - type: workflow.run
          workflowName: parallel_notebooks_execution
          trailLogs: true
View Airflow Workflow
notebooks_workflow:
  dag_id: notebooks_parallel
  tasks:
    nb_churn:
      operator: airflow.providers.amazon.aws.operators.sagemaker_unified_studio.SageMakerNotebookOperator
      retries: 0
      domain_id: "{domain.id}"
      project_id: "{proj.id}"
      domain_region: "{domain.region}"
      input_config:
        input_path: notebooks/bundle/notebooks/customer_churn_prediction.ipynb
        input_params: {}
      output_config:
        output_formats:
        - NOTEBOOK
      compute:
        instance_type: ml.c5.xlarge
        image_details:
          image_name: sagemaker-distribution-prod
          image_version: '3'
      wait_for_completion: true
    nb_sales:
      operator: airflow.providers.amazon.aws.operators.sagemaker_unified_studio.SageMakerNotebookOperator
      retries: 0
      domain_id: "{domain.id}"
      project_id: "{proj.id}"
      domain_region: "{domain.region}"
      input_config:
        input_path: notebooks/bundle/notebooks/retail_sales_forecasting.ipynb
        input_params: {}
      output_config:
        output_formats:
        - NOTEBOOK
      compute:
        instance_type: ml.c5.xlarge
        image_details:
          image_name: sagemaker-distribution-prod
          image_version: '3'
      wait_for_completion: true
    nb_segment:
      operator: airflow.providers.amazon.aws.operators.sagemaker_unified_studio.SageMakerNotebookOperator
      retries: 0
      domain_id: "{domain.id}"
      project_id: "{proj.id}"
      domain_region: "{domain.region}"
      input_config:
        input_path: notebooks/bundle/notebooks/customer_segmentation_analysis.ipynb
        input_params: {}
      output_config:
        output_formats:
        - NOTEBOOK
      compute:
        instance_type: ml.c5.xlarge
        image_details:
          image_name: sagemaker-distribution-prod
          image_version: '3'
      wait_for_completion: true

View Full Example →


🤖 Machine Learning - Training

Train ML models with SageMaker using the SageMaker SDK and SageMaker Distribution images. Track experiments with MLflow and automate training pipelines with environment-specific configurations.

AWS Services: SageMaker Training • MLflow • S3 • MWAA Serverless

GitHub Workflow: analytic-ml-training.yml

What happens during deployment: Training code and workflow definitions are uploaded to S3 with compression, Airflow DAG is created for training orchestration, MLflow connection is provisioned for experiment tracking, and SageMaker training jobs are created and executed using SageMaker Distribution images.

📁 App Structure
ml/training/
├── manifest.yaml                      # Deployment configuration
├── code/
│   ├── sagemaker_training_script.py  # Training script
│   └── requirements.txt              # Python dependencies
├── workflows/
│   ├── ml_training_workflow.yaml     # Airflow orchestration
│   └── ml_training_notebook.ipynb    # Training notebook
└── app_tests/
    └── test_model_registration.py    # Integration tests

Key Files:

  • Training Script: SageMaker training job implementation
  • Workflow: Airflow DAG for training orchestration
  • Notebook: Interactive training workflow
  • Tests: Validate model registration and training
View Manifest
applicationName: IntegrationTestMLTraining

content:
  storage:
    - name: training-code
      connectionName: default.s3_shared
      include: [ml/training/code]
    
    - name: training-workflows
      connectionName: default.s3_shared
      include: [ml/training/workflows]
  
  workflows:
    - workflowName: ml_training_workflow
      connectionName: default.workflow_serverless

stages:
  test:
    domain:
      region: us-east-1
    project:
      name: test-ml-training
      owners:
        - Eng1
        - arn:aws:iam::${AWS_ACCOUNT_ID}:role/GitHubActionsRole-SMUS-CLI-Tests
      role:
        arn: arn:aws:iam::${AWS_ACCOUNT_ID}:role/SMUSCICDTestRole
    environment_variables:
      S3_PREFIX: test
    deployment_configuration:
      storage:
        - name: training-code
          connectionName: default.s3_shared
          targetDirectory: ml/bundle/training-code
          compression: gz
        - name: training-workflows
          connectionName: default.s3_shared
          targetDirectory: ml/bundle/training-workflows
    bootstrap:
      actions:
        - type: datazone.create_connection
          name: mlflow-server
          connection_type: MLFLOW
          properties:
            trackingServerArn: arn:aws:sagemaker:${TEST_DOMAIN_REGION}:${AWS_ACCOUNT_ID}:mlflow-tracking-server/smus-integration-mlflow-use2
        - type: workflow.create
          workflowName: ml_training_workflow
        - type: workflow.run
          workflowName: ml_training_workflow
          trailLogs: true
View Airflow Workflow
ml_training_workflow:
  dag_id: "ml_training_workflow"
  tasks:
    ml_training_notebook:
      operator: "airflow.providers.amazon.aws.operators.sagemaker_unified_studio.SageMakerNotebookOperator"
      retries: 0
      domain_id: "{domain.id}"
      project_id: "{proj.id}"
      domain_region: "{domain.region}"
      input_config:
        input_path: "ml/bundle/training-workflows/ml_training_notebook.ipynb"
        input_params:
          mlflow_tracking_server_arn: "{proj.connection.mlflow-server.trackingServerArn}"
          mlflow_artifact_location: "{proj.connection.default.s3_shared.s3Uri}ml/mlflow-artifacts"
          sklearn_version: "1.2-1"
          python_version: "py3"
          training_instance_type: "ml.m5.large"
          model_name: "realistic-classifier-v1"
      output_config:
        output_formats: 
          ['NOTEBOOK']
      wait_for_completion: True

View Full Example →


🤖 Machine Learning - Deployment

Deploy trained ML models as SageMaker real-time inference endpoints. Uses SageMaker SDK for endpoint configuration and SageMaker Distribution images for serving.

AWS Services: SageMaker Endpoints • S3 • MWAA Serverless

GitHub Workflow: analytic-ml-deployment.yml

What happens during deployment: Model artifacts, deployment code, and workflow definitions are uploaded to S3, Airflow DAG is created for endpoint deployment orchestration, SageMaker endpoint configuration and model are created, and the inference endpoint is deployed and ready to serve predictions.

📁 App Structure
ml/deployment/
├── manifest.yaml                      # Deployment configuration
├── code/
│   └── inference.py                  # Inference handler
├── workflows/
│   ├── ml_deployment_workflow.yaml   # Airflow orchestration
│   └── ml_deployment_notebook.ipynb  # Deployment notebook
└── app_tests/
    └── test_endpoint_deployment.py   # Integration tests

Key Files:

  • Inference Handler: Custom inference logic for endpoint
  • Workflow: Airflow DAG for endpoint deployment
  • Notebook: Interactive deployment workflow
  • Tests: Validate endpoint deployment and predictions
View Manifest
applicationName: IntegrationTestMLDeployment

content:
  storage:
    - name: deployment-code
      connectionName: default.s3_shared
      include: [ml/deployment/code]
    
    - name: deployment-workflows
      connectionName: default.s3_shared
      include: [ml/deployment/workflows]
    
    - name: model-artifacts
      connectionName: default.s3_shared
      include: [ml/output/model-artifacts/latest]
  
  workflows:
    - workflowName: ml_deployment_workflow
      connectionName: default.workflow_serverless

stages:
  test:
    domain:
      region: us-east-1
    project:
      name: test-ml-deployment
      owners:
        - Eng1
        - arn:aws:iam::${AWS_ACCOUNT_ID}:role/GitHubActionsRole-SMUS-CLI-Tests
      role:
        arn: arn:aws:iam::${AWS_ACCOUNT_ID}:role/SMUSCICDTestRole
    environment_variables:
      S3_PREFIX: test
    deployment_configuration:
      storage:
        - name: deployment-code
          connectionName: default.s3_shared
          targetDirectory: ml/bundle/deployment-code
        - name: deployment-workflows
          connectionName: default.s3_shared
          targetDirectory: ml/bundle/deployment-workflows
        - name: model-artifacts
          connectionName: default.s3_shared
          targetDirectory: ml/bundle/model-artifacts
    bootstrap:
      actions:
        - type: workflow.create
          workflowName: ml_deployment_workflow
        - type: workflow.run
          workflowName: ml_deployment_workflow
          trailLogs: true
View Airflow Workflow
ml_deployment_workflow:
  dag_id: "ml_deployment_workflow"
  tasks:
    ml_deployment_notebook:
      operator: "airflow.providers.amazon.aws.operators.sagemaker_unified_studio.SageMakerNotebookOperator"
      retries: 0
      domain_id: "{domain.id}"
      project_id: "{proj.id}"
      domain_region: "{domain.region}"
      input_config:
        input_path: "ml/bundle/deployment-workflows/ml_deployment_notebook.ipynb"
        input_params:
          model_s3_uri: "{proj.connection.default.s3_shared.s3Uri}ml/output/model-artifacts/latest/output/model.tar.gz"
          sklearn_version: "1.2-1"
          python_version: "py3"
          inference_instance_type: "ml.m5.large"
      output_config:
        output_formats: 
          ['NOTEBOOK']
      wait_for_completion: True

View Full Example →


🧠 Generative AI

Deploy GenAI applications with Bedrock agents and knowledge bases. Demonstrates RAG (Retrieval Augmented Generation) workflows with automated agent deployment and testing.

AWS Services: Amazon Bedrock • S3 • MWAA Serverless

GitHub Workflow: analytic-genai-workflow.yml

What happens during deployment: Agent configuration and workflow definitions are uploaded to S3, Airflow DAG is created for agent deployment orchestration, Bedrock agents and knowledge bases are configured, and the GenAI application is ready for inference and testing.

📁 App Structure
genai/
├── manifest.yaml                      # Deployment configuration
├── job-code/
│   ├── requirements.txt              # Python dependencies
│   ├── test_agent.yaml               # Agent test configuration
│   ├── lambda_mask_string.py         # Lambda function
│   └── utils/
│       ├── bedrock_agent.py          # Agent management
│       ├── bedrock_agent_helper.py   # Agent utilities
│       └── knowledge_base_helper.py  # Knowledge base utilities
├── workflows/
│   ├── genai_dev_workflow.yaml       # Airflow orchestration
│   └── bedrock_agent_notebook.ipynb  # Agent deployment notebook
└── app_tests/
    └── test_genai_workflow.py        # Integration tests

Key Files:

  • Agent Code: Bedrock agent and knowledge base management
  • Workflow: Airflow DAG for GenAI deployment
  • Notebook: Interactive agent deployment
  • Tests: Validate agent functionality
View Manifest
applicationName: IntegrationTestGenAIWorkflow

content:
  storage:
    - name: agent-code
      connectionName: default.s3_shared
      include: [genai/job-code]
    
    - name: genai-workflows
      connectionName: default.s3_shared
      include: [genai/workflows]
  
  workflows:
    - workflowName: genai_dev_workflow
      connectionName: default.workflow_serverless

stages:
  test:
    domain:
      region: us-east-1
    project:
      name: test-marketing
      owners:
        - Eng1
        - arn:aws:iam::${AWS_ACCOUNT_ID}:role/GitHubActionsRole-SMUS-CLI-Tests
    environment_variables:
      S3_PREFIX: test
    deployment_configuration:
      storage:
        - name: agent-code
          connectionName: default.s3_shared
          targetDirectory: genai/bundle/agent-code
        - name: genai-workflows
          connectionName: default.s3_shared
          targetDirectory: genai/bundle/workflows
View Airflow Workflow
genai_dev_workflow:
  dag_id: "genai_dev_workflow"
  tasks:
    bedrock_agent_notebook:
      operator: "airflow.providers.amazon.aws.operators.sagemaker_unified_studio.SageMakerNotebookOperator"
      retries: 0
      domain_id: "{domain.id}"
      project_id: "{proj.id}"
      domain_region: "{domain.region}"
      input_config:
        input_path: "genai/bundle/workflows/bedrock_agent_notebook.ipynb"
        input_params:
          agent_name: "calculator_agent"
          agent_llm: "us.anthropic.claude-3-5-sonnet-20241022-v2:0"
          force_recreate: "True"
          kb_name: "mortgage-kb"
      output_config:
        output_formats: 
          ['NOTEBOOK']
      wait_for_completion: True

View Full Example →


See All Examples with Detailed Walkthroughs →


🔐 IdC Domain Setup

The examples above support both IAM-based and IAM Identity Center (IdC)-based domains. IdC domains require additional one-time setup due to VpcOnly networking and tag-based IAM policies. Each example includes a setup script:

Example Setup Script What It Does
Data Notebooks idc_domain_project_setup.py VPC networking (S3 gateway endpoint, NAT gateway), Lake Formation permissions on sagemaker_sample_db
ML Training idc_domain_project_setup.py MLflow tracking server access, CloudWatch Logs permissions
ML Deployment Uses the same project role as ML Training No additional setup beyond ML Training
# Run setup for data-notebooks (IdC domain)
TEST_DOMAIN_REGION=us-east-1 python examples/analytic-workflow/data-notebooks/idc_domain_project_setup.py

# Run setup for ML training (IdC domain)
TEST_DOMAIN_REGION=us-east-1 python examples/analytic-workflow/ml/training/idc_domain_project_setup.py

# Dry run to preview changes
python examples/analytic-workflow/data-notebooks/idc_domain_project_setup.py --dry-run

All setup scripts are idempotent and safe to run multiple times. Use --dry-run to preview changes before applying.



📋 Feature Checklist

Legend: ✅ Supported | 🔄 Planned | 🔮 Future

Core Infrastructure

Feature Status Notes
YAML configuration Manifest Guide
Infrastructure as Code Deploy Command
Multi-environment deployment Stages
CLI tool CLI Commands
Version control integration GitHub Actions

Deployment & Bundling

Automated Deployment - Define your application content, workflows, and deployment targets in YAML. Bundle-based (artifact) or direct (git-based) deployment modes. Deploy to test and prod with a single command. Dynamic configuration using ${VAR} substitution. Track deployments in S3 or git for deployment history.

Feature Status Notes
Artifact bundling Bundle Command
Bundle-based deployment Deploy Command
Direct deployment Deploy Command
Deployment validation Describe Command
Dry-run validation Deploy --dry-run
Incremental deployment 🔄 Upload only changed files
Rollback support 🔮 Automated rollback
Blue-green deployment 🔮 Zero-downtime deployments

Developer Experience

Feature Status Notes
Project templates 🔄 aws-smus-cicd-cli init with templates
Manifest initialization Create Command
Interactive setup 🔄 Guided configuration prompts
Local development CLI Commands
VS Code extension 🔮 IntelliSense and validation

Configuration

Environment Variables & Dynamic Configuration - Flexible configuration for any environment using variable substitution. Environment-specific settings with validation and connection management.

Feature Status Notes
Variable substitution Substitutions Guide
Environment-specific config Stages
Secrets management 🔮 AWS Secrets Manager integration
Config validation Manifest Schema
Connection management Connections Guide

Resources & Workloads

Deploy Any AWS Service - Airflow DAGs, Jupyter notebooks, Glue ETL jobs, Athena queries, SageMaker training and endpoints, QuickSight dashboards, Bedrock agents, Lambda functions, EMR jobs, and Redshift queries.

Feature Status Notes
Airflow DAGs Workflows
Jupyter notebooks SageMakerNotebookOperator
Glue ETL jobs GlueJobOperator
Athena queries AthenaOperator
SageMaker training SageMakerTrainingOperator
SageMaker endpoints SageMakerEndpointOperator
QuickSight dashboards QuickSight Deployment
Bedrock agents BedrockInvokeModelOperator
Lambda functions 🔄 LambdaInvokeFunctionOperator
EMR jobs EmrAddStepsOperator
Redshift queries RedshiftDataOperator

Bootstrap Actions

Automated Workflow Execution & Event-Driven Workflows - Trigger workflows automatically during deployment with workflow.run (use trailLogs: true to stream logs and wait for completion). Fetch workflow logs for validation and debugging with workflow.logs. Automatically refresh QuickSight dashboards after ETL deployment with quicksight.refresh_dataset. Emit custom events for downstream automation and CI/CD orchestration with eventbridge.put_events. Provision MLflow and other DataZone connections during deployment. Actions run in order during aws-smus-cicd-cli deploy for reliable initialization and validation.

Feature Status Notes
Workflow execution workflow.run
Log retrieval workflow.logs
QuickSight refresh quicksight.refresh_dataset
EventBridge events eventbridge.put_events
DataZone connections datazone.create_connection
Sequential execution Execution Flow

CI/CD Integration

Pre-built CI/CD Pipeline Workflows - GitHub Actions, GitLab CI, Azure DevOps, and Jenkins support for automated deployment. Flexible configuration for any CI/CD platform. Trigger deployments from external events with webhook support.

Feature Status Notes
GitHub Actions GitHub Actions Guide
GitLab CI CLI Commands
Azure DevOps CLI Commands
Jenkins CLI Commands
Service principals GitHub Actions Guide
OIDC federation GitHub Actions Guide

Testing & Validation

Automated Tests & Quality Gates - Run validation tests before promoting to production. Block deployments if tests fail. Track execution status and logs. Verify deployment correctness with health checks.

Feature Status Notes
Unit testing Test Command
Integration testing Test Command
Automated tests Test Command
Quality gates Test Command
Workflow monitoring Monitor Command

Monitoring & Observability

Feature Status Notes
Deployment monitoring Deploy Command
Workflow monitoring Monitor Command
Custom alerts Deployment Metrics
Metrics collection Deployment Metrics
Deployment history Bundle Command

AWS Service Integration

Feature Status Notes
Amazon MWAA Workflows
MWAA Serverless Workflows
AWS Glue Airflow Operators
Amazon Athena Airflow Operators
SageMaker Airflow Operators
Amazon Bedrock Airflow Operators
Amazon QuickSight QuickSight Deployment
DataZone Manifest Schema
EventBridge Deployment Metrics
Lake Formation Connections Guide
Amazon S3 Storage
AWS Lambda 🔄 Airflow Operators
Amazon EMR Airflow Operators
Amazon Redshift Airflow Operators

Advanced Features

Feature Status Notes
Multi-region deployment Stages
Cross-project deployment Stages
Dependency management Airflow Operators
Catalog subscriptions Manifest Schema
Multi-service orchestration Airflow Operators
Drift detection 🔮 Detect configuration drift
State management 🔄 Comprehensive state tracking

Documentation

Premiers pas

Guides

Référence

Exemples

Développement

Support


Avis de sécurité

Installez toujours à partir du package PyPI officiel d'AWS ou du code source.

# ✅ Correct - Installer depuis le package PyPI officiel d'AWS
pip install aws-smus-cicd-cli

# ✅ Également correct - Installer depuis le code source officiel d'AWS
git clone https://github.com/aws/CICD-for-SageMakerUnifiedStudio.git
cd CICD-for-SageMakerUnifiedStudio
pip install -e .

Licence

Ce projet est sous licence Apache, version 2.0. Voir LICENSE pour plus de détails.


Scanner pour voir le README

Scanner le code QR pour voir ce README sur GitHub