Custom blueprints/pipelines - MLOps Workload Orchestrator

Custom blueprints/pipelines

This solution supports adding custom blueprints implemented as AWS CloudFormation templates. You can add a custom blueprint with two steps:

  1. Create your custom AWS CloudFormation template or AWS Lambda functions.

  2. Update the Orchestrator Lambda function to add your custom blueprint’s logic.

Create your custom AWS CloudFormation template or Lambda functions

The MLOps Workload Orchestrator uses AWS Cloud Development Kit (AWS CDK) (CDK) to generate all its AWS CloudFormation templates and supporting resources such as Lambda functions.

Use the following steps to integrate a custom template:

  1. Add your template’s CDK code under source/infrastructure/lib/blueprints/pipeline_definitions.

  2. Make sure your template creates any required roles or permissions. You can reuse existing IAM polices defined in source/infrastructure/lib/blueprints/pipeline_definitions/iam_policies.py, or create your own.

  3. If your template has Lambda functions, add them under source/infrastructure/lib/blueprints/lambdas. Lambda functions are uploaded to the Blueprints S3 bucket, under the prefix blueprints/byom/lambdas. The name of the Lambda function’s folder must be used in your template’s CDK code. For example, if your Lambda function folder’s name is myfunction, you must refer to it as blueprints/byom/lambdas/myfunction.zip in your CDK code.

  4. Add your template stack to the CDK’s application at source/infrastructure/app.py.

  5. Add your code to generate the template in deployment/build-s3-dist.sh. Follow the documented steps in the build script. Your custom template and any Lambda functions, are packaged with the solution’s templates or Lambda functions in the blueprints.zip file. The zip file is uploaded to the Blueprints Amazon S3 bucket when the solution is deployed.

Update the Orchestrator Lambda function to add your custom blueprint’s logic

The Orchestrator Lambda function provisions all the solution’s blueprints. You must update the Orchestrator Lambda function code at: source/lambdas/pipeline_orchestration/lambda_helpers.py to add your custom blueprint’s template logic.

Use the following steps to update the Orchestrator Lambda function:

  1. Update the template_url function to add your custom template URL. You must create your own pipeline_type, which is used to identify the custom template. For example, byom_realtime_builtin is used for the real-time inference with built-in SageMaker algorithms pipeline.

  2. Update the get_stack_name function to add a stack name for your template.

  3. Update the get_template_parameters function to get your template’s parameters. You can follow the same approach to create a function to get your template’s parameters from the API call payload, similar to the functions get_realtime_specific_params, get_batch_specific_params, get_model_monitor_params, and others.

  4. Add required APIs call keys to get_required_keys. This function is used by the validate function to validate that the API call payload contains the required keys (parameters) used by your template.

  5. Add any additional IAM permissions to the create_orchestrator_policy function in source/infrastructure/lib/blueprints/pipeline_definitions/iam_policies.py.