This folder contains the CDK infrastructure for the multi-variant deployment pipeline.
This deployment pipeline contains a few stages.
- Source: Pull the latest deployment configuration from AWS CodeCommit repository.
- Build: AWS CodeBuild job to create the AWS CloudFormation template for deploying the endpoint.
- Query the Amazon SageMaker project to get the top approved models.
- Use the AWS CDK to create a CFN stack to deploy multi-variant SageMaker Endpoint.
- Deploy: Run the AWS CloudFormation stack to create/update the SageMaker endpoint, tagged with properties based on configuration:
ab-testing:enabled
equalstrue
ab-testing:strategy
is oneWeightedSampling
,EpslionGreedy
,UCB1
orThompsonSampling
.ab-testing:epsilon
is parameters forEpslionGreedy
strategy, defaults to0.1
.ab-testing:warmup
the number of invocations to warmup withWeightedSampling
strategy, defaults to0
.
Once you have created a SageMaker Project, you can test the Build stage and Register events locally by setting some environment variables.
Export the environment variables for the SAGEMAKER_PROJECT_NAME
and SAGEMAKER_PROJECT_ID
created by your SageMaker Project cloud formation. Then run the cdk synth
command:
export SAGEMAKER_PROJECT_NAME="<<project_name>>"
export SAGEMAKER_PROJECT_ID="<<project_id>>"
export STAGE_NAME="dev"
cdk synth
Export the environment variable for the REGISTER_LAMBDA
created as part of the ab-testing-api
stack, then run register.py
file.
export REGISTER_LAMBDA="<<register_lambda>>"
python register.py