version: 0.2 phases: install: runtime-versions: python: 3.8 commands: # Upgrade AWS CLI to the latest version - pip install --upgrade --force-reinstall "botocore>1.21.30" "boto3>1.18.30" "awscli>1.20.30" "sagemaker>=2.63.0" build: commands: # Export the staging and production configuration files - | python build.py \ --aws-region $AWS_REGION \ --default-bucket $ARTIFACT_BUCKET \ --model-execution-role $MODEL_EXECUTION_ROLE_ARN \ --model-package-group-names $SOURCE_MODEL_PACKAGE_GROUP_NAMES \ --sagemaker-project-id $SAGEMAKER_PROJECT_ID \ --sagemaker-project-name $SAGEMAKER_PROJECT_NAME \ --inference-framework-version "1.12" \ --inference-python-version "py38" \ --export-staging-config $EXPORT_TEMPLATE_STAGING_CONFIG \ --export-prod-config $EXPORT_TEMPLATE_PROD_CONFIG \ --sagemaker-project-arn $SAGEMAKER_PROJECT_ARN # Package the infrastucture as code defined in endpoint-config-template.yml by using AWS CloudFormation. # Note that the Environment Variables like ARTIFACT_BUCKET, SAGEMAKER_PROJECT_NAME etc,. used below are expected to be setup by the # CodeBuild resrouce in the infra pipeline (in the ServiceCatalog product) - aws cloudformation package --template endpoint-config-template.yml --s3-bucket $ARTIFACT_BUCKET --output-template $EXPORT_TEMPLATE_NAME # Print the files to verify contents - cat $EXPORT_TEMPLATE_STAGING_CONFIG - cat $EXPORT_TEMPLATE_PROD_CONFIG artifacts: files: - $EXPORT_TEMPLATE_NAME - $EXPORT_TEMPLATE_STAGING_CONFIG - $EXPORT_TEMPLATE_PROD_CONFIG