Skip to content

Latest commit

 

History

History
1239 lines (1009 loc) · 62.6 KB

File metadata and controls

1239 lines (1009 loc) · 62.6 KB

en pt fr it ja zh he

Back to Main README

SMUS CI/CD パイプライン CLI

[IAM + IdC ドメイン] この CLI は IAM ベースと IAM Identity Center (IdC) ベースの両方の SMUS ドメインをサポートしています。IdC ドメインの場合、追加のセットアップ (VPC ネットワーキング、Lake Formation パーミッション、インライン IAM ポリシー) が必要になる場合があります — 各サンプルディレクトリのセットアップスクリプトを参照してください。

SageMaker Unified Studio 環境全体でのデータアプリケーションのデプロイを自動化

Airflow DAG、Jupyter ノートブック、ML ワークフローを開発環境から本番環境まで自信を持ってデプロイできます。DevOps チームと協力するデータサイエンティスト、データエンジニア、ML エンジニア、GenAI アプリ開発者向けに構築されています。

あなたのデプロイ戦略に対応: git ブランチ (ブランチベース)、バージョン管理されたアーティファクト (バンドルベース)、git タグ (タグベース)、または直接デプロイのいずれを使用する場合でも、この CLI はあなたのワークフローをサポートします。アプリケーションを一度定義すれば、あなたの方法でデプロイできます。


なぜ SMUS CI/CD CLI なのか?

AWS 抽象化レイヤー - CLI が AWS のアナリティクス、ML、SMUS の複雑さをすべてカプセル化 - DevOps チームが AWS API を直接呼び出すことはありません
関心の分離 - データチームは何をデプロイするかを定義し (manifest.yaml)、DevOps チームはどのように、いつデプロイするかを定義します (CI/CD ワークフロー)
汎用的な CI/CD ワークフロー - 同じワークフローが Glue、SageMaker、Bedrock、QuickSight、または任意の AWS サービスの組み合わせで機能します
自信を持ってデプロイ - デプロイ前のドライラン検証と本番環境前の自動テスト
マルチ環境管理 - テスト → 本番環境への環境固有の設定
Infrastructure as Code - バージョン管理されたアプリケーションマニフェストと再現可能なデプロイメント
イベント駆動型ワークフロー - デプロイ時に EventBridge 経由でワークフローを自動的にトリガー


クイックスタート

インストール:

pip install aws-smus-cicd-cli

最初のアプリケーションをデプロイ:

# 設定を検証
aws-smus-cicd-cli describe --manifest manifest.yaml --connect

# デプロイバンドルを作成(オプション)
aws-smus-cicd-cli bundle --manifest manifest.yaml

# デプロイをプレビュー(ドライラン)
aws-smus-cicd-cli deploy --targets test --manifest manifest.yaml --dry-run

# テスト環境にデプロイ
aws-smus-cicd-cli deploy --targets test --manifest manifest.yaml

# 検証テストを実行
aws-smus-cicd-cli test --manifest manifest.yaml --targets test

# 完了後にクリーンアップ
aws-smus-cicd-cli destroy --manifest manifest.yaml --targets test --force

実際の動作を確認: GitHub Actions のライブ例


対象者

👨‍💻 データチーム (データサイエンティスト、データエンジニア、GenAI アプリ開発者)

あなたが注力すること: アプリケーション - 何をデプロイするか、どこにデプロイするか、どのように実行するか
あなたが定義するもの: コード、ワークフロー、設定を含むアプリケーションマニフェスト (manifest.yaml)
知る必要がないこと: CI/CD パイプライン、GitHub Actions、デプロイ自動化

クイックスタートガイド - 10分で最初のアプリケーションをデプロイ

以下の例を含みます:

  • データエンジニアリング (Glue、Notebooks、Athena)
  • ML ワークフロー (SageMaker、Notebooks)
  • GenAI アプリケーション (Bedrock、Notebooks)

🔧 DevOps チーム

あなたが注力すること: CI/CD ベストプラクティス、セキュリティ、コンプライアンス、デプロイ自動化
あなたが定義するもの: テスト、承認、プロモーションポリシーを強制するワークフローテンプレート
知る必要がないこと: アプリケーション固有の詳細、使用される AWS サービス、DataZone API、SMUS プロジェクト構造、ビジネスロジック

管理者ガイド - 15分でインフラストラクチャとパイプラインを設定
GitHub ワークフローテンプレート - 自動デプロイ用の汎用的で再利用可能なワークフローテンプレート

CLI はあなたの抽象化レイヤーです: aws-smus-cicd-cli deploy を呼び出すだけで、CLI がすべての AWS サービスとのやり取り (DataZone、Glue、Athena、SageMaker、MWAA、S3、IAM など) を処理します。ワークフローはシンプルで汎用的なままです。


デプロイ可能なもの

📊 分析 & BI

  • Glue ETL ジョブとクローラー
  • Athena クエリ
  • QuickSight ダッシュボード
  • EMR ジョブ(今後対応予定)
  • Redshift クエリ(今後対応予定)

🤖 機械学習

  • SageMaker トレーニングジョブ
  • ML モデルとエンドポイント
  • MLflow 実験
  • Feature Store(今後対応予定)
  • バッチ変換(今後対応予定)

🧠 生成 AI

  • Bedrock エージェント
  • ナレッジベース
  • 基盤モデル設定(今後対応予定)

📓 コード & ワークフロー

  • Jupyter ノートブック
  • Python スクリプト
  • Airflow DAG(MWAA および Amazon MWAA Serverless)
  • Lambda 関数(今後対応予定)

💾 データ & ストレージ

  • S3 データファイル
  • Git リポジトリ
  • DataZone カタログリソース(用語集、用語集用語、フォームタイプ、アセットタイプ、アセット、データプロダクト、メタデータフォーム)

サポートされている AWS サービス

Airflow YAML 構文を使用して、以下の AWS サービスを利用したワークフローをデプロイできます:

🎯 分析とデータ

Amazon AthenaAWS GlueAmazon EMRAmazon RedshiftAmazon QuickSightLake Formation

🤖 機械学習

SageMaker TrainingSageMaker PipelinesFeature StoreModel RegistryBatch Transform

🧠 生成 AI

Amazon BedrockBedrock AgentsBedrock Knowledge BasesGuardrails

📊 その他のサービス

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

完全なリストを参照: Airflow AWS Operators Reference


コア概念

関心の分離: 主要な設計原則

問題点: 従来のデプロイメントアプローチでは、DevOps チームが AWS 分析サービス(Glue、Athena、DataZone、SageMaker、MWAA など)を学習し、SMUS プロジェクト構造を理解する必要があるか、データチームが CI/CD の専門家になる必要がありました。

解決策: SMUS CI/CD CLI は、すべての AWS と SMUS の複雑さをカプセル化する抽象化レイヤーです。

ワークフローの例:

1. DevOps チーム              2. データチーム                  3. SMUS CI/CD CLI(抽象化レイヤー)
   ↓                               ↓                              ↓
プロセスを定義                  コンテンツを定義                ワークフローの呼び出し:
- マージ時のテスト              - Glue ジョブ                   aws-smus-cicd-cli deploy --manifest manifest.yaml
- 本番環境への承認              - SageMaker トレーニング          ↓
- セキュリティスキャン          - Athena クエリ                 CLI がすべての AWS の複雑さを処理:
- 通知ルール                    - ファイル構造                  - DataZone API
                                                              - Glue/Athena/SageMaker API
インフラストラクチャを定義                                      - MWAA デプロイメント
- アカウントとリージョン                                        - S3 管理
- IAM ロール                                                   - IAM 設定
- リソース                                                     - インフラストラクチャのプロビジョニング

あらゆるアプリに対応!
ML/Analytics/GenAI
サービスの知識は不要!

DevOps チームが注力すること:

  • CI/CD のベストプラクティス(テスト、承認、通知)
  • セキュリティとコンプライアンスゲート
  • デプロイメントのオーケストレーション
  • モニタリングとアラート

SMUS CI/CD CLI がすべての AWS の複雑さを処理:

  • DataZone ドメインとプロジェクト管理
  • AWS Glue、Athena、SageMaker、MWAA API
  • S3 ストレージとアーティファクト管理
  • IAM ロールと権限
  • 接続設定
  • カタログアセットのサブスクリプション
  • Airflow へのワークフローデプロイメント
  • インフラストラクチャのプロビジョニング
  • テストと検証

データチームが注力すること:

  • アプリケーションコードとワークフロー
  • 使用する AWS サービス(Glue、Athena、SageMaker など)
  • 環境設定
  • ビジネスロジック

結果:

  • DevOps チームは AWS API を直接呼び出さない - aws-smus-cicd-cli deploy を呼び出すだけ
  • CI/CD ワークフローは汎用的 - 同じワークフローが Glue アプリ、SageMaker アプリ、Bedrock アプリで動作
  • データチームは CI/CD 設定に触れない
  • 両チームがそれぞれの専門知識を活かして独立して作業

アプリケーションマニフェスト

データアプリケーションを定義する宣言的な YAML ファイル(manifest.yaml):

  • アプリケーション詳細 - 名前、バージョン、説明
  • コンテンツ - git リポジトリからのコード、ストレージからのデータ/モデル、QuickSight ダッシュボード
  • ワークフロー - オーケストレーションと自動化のための Airflow DAG
  • ステージ - デプロイ先(dev、test、prod 環境)
  • 設定 - 環境固有の設定、接続、ブートストラップアクション

データチームが作成し所有します。 何をデプロイし、どこにデプロイするかを定義します。CI/CD の知識は不要です。

アプリケーション

デプロイされるデータ/分析ワークロード:

  • Airflow DAG と Python スクリプト
  • Jupyter ノートブックとデータファイル
  • ML モデルとトレーニングコード
  • ETL パイプラインと変換処理
  • GenAI エージェントと MCP サーバー
  • 基盤モデルの設定

ステージ

SageMaker Unified Studio プロジェクトにマッピングされたデプロイメント環境(dev、test、prod):

  • ドメインとリージョンの設定
  • プロジェクト名と設定
  • リソース接続(S3、Airflow、Athena、Glue)
  • 環境固有のパラメータ
  • git ベースのデプロイメント用のオプションのブランチマッピング

ステージからプロジェクトへのマッピング

各アプリケーションステージは、専用の SageMaker Unified Studio(SMUS)プロジェクトにデプロイされます。プロジェクトは、アーキテクチャと CI/CD 手法に応じて、単一のアプリケーションまたは複数のアプリケーションをホストできます。ステージプロジェクトは、独自のガバナンスを持つ独立したエンティティです:

  • 所有権とアクセス: 各ステージプロジェクトには独自の所有者と貢献者がおり、開発プロジェクトとは異なる場合があります。本番プロジェクトは通常、開発環境と比較してアクセスが制限されています。
  • マルチドメインとマルチリージョン: ステージプロジェクトは、異なる SMUS ドメイン、AWS アカウント、リージョンに属することができます。例えば、dev ステージは us-east-1 の開発ドメインにデプロイし、prod は eu-west-1 の本番ドメインにデプロイする場合があります。
  • 柔軟なアーキテクチャ: 組織は、セキュリティ、コンプライアンス、運用要件に基づいて、アプリケーションごとの専用プロジェクト(分離)または複数のアプリケーションをホストする共有プロジェクト(統合)を選択できます。

この分離により、独立したアクセス制御、コンプライアンス境界、リージョナルデータレジデンシー要件を持つ真の環境分離が可能になります。

ワークフロー

アプリケーションを実行するオーケストレーションロジック。ワークフローには2つの目的があります:

1. デプロイメント時: デプロイメント中に必要な AWS リソースを作成

  • インフラストラクチャのプロビジョニング(S3 バケット、データベース、IAM ロール)
  • 接続と権限の設定
  • モニタリングとロギングのセットアップ

2. ランタイム: 継続的なデータと ML パイプラインの実行

  • スケジュール実行(日次、時間単位など)
  • イベント駆動トリガー(S3 アップロード、API 呼び出し)
  • データ処理と変換
  • モデルのトレーニングと推論

ワークフローは YAML 形式の Airflow DAG(Directed Acyclic Graphs)として定義されます。MWAA(Managed Workflows for Apache Airflow)Amazon MWAA Serverlessユーザーガイド)をサポートしています。

CI/CD 自動化

デプロイメントを自動化する GitHub Actions ワークフロー(または他の CI/CD システム):

  • DevOps チームが作成し所有
  • どのようにいつデプロイするかを定義
  • テストと品質ゲートの実行
  • ターゲット間でのプロモーション管理
  • セキュリティとコンプライアンスポリシーの適用
  • 例: .github/workflows/deploy.yml

重要な洞察: DevOps チームは、あらゆるアプリケーションで動作する汎用的で再利用可能なワークフローを作成します。アプリが Glue、SageMaker、Bedrock のどれを使用しているかを知る必要はありません - CLI がすべての AWS サービスとのやり取りを処理します。ワークフローは単に aws-smus-cicd-cli deploy を呼び出すだけで、CLI が残りを行います。

デプロイメントモード

バンドルベース(アーティファクト): バージョン管理されたアーカイブを作成 → アーカイブをステージにデプロイ

  • 適している用途: 監査証跡、ロールバック機能、コンプライアンス
  • コマンド: aws-smus-cicd-cli bundle の後に aws-smus-cicd-cli deploy --manifest app.tar.gz

ダイレクト(Git ベース): 中間アーティファクトなしでソースから直接デプロイ

  • 適している用途: よりシンプルなワークフロー、迅速な反復、信頼できる情報源としての git
  • コマンド: aws-smus-cicd-cli deploy --manifest manifest.yaml --targets test

両方のモードは、ストレージと 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

ドキュメント

はじめに

ガイド

リファレンス

開発

サポート


セキュリティに関する注意事項

必ず公式の AWS PyPI パッケージまたはソースコードからインストールしてください。

# ✅ 正しい - 公式 AWS PyPI パッケージからインストール
pip install aws-smus-cicd-cli

# ✅ こちらも正しい - 公式 AWS ソースコードからインストール
git clone https://github.com/aws/CICD-for-SageMakerUnifiedStudio.git
cd CICD-for-SageMakerUnifiedStudio
pip install -e .

ライセンス

このプロジェクトは Apache License, Version 2.0 の下でライセンスされています。詳細は LICENSE を参照してください。


Scan to view README

QR コードをスキャンして GitHub で README を表示