-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuildspec.yml
30 lines (25 loc) · 1.46 KB
/
buildspec.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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"
build:
commands:
# Export the staging and production configuration files
- python build.py --model-execution-role "$MODEL_EXECUTION_ROLE_ARN" --model-package-group-name "$SOURCE_MODEL_PACKAGE_GROUP_NAME" --sagemaker-project-id "$SAGEMAKER_PROJECT_ID" --sagemaker-project-name "$SAGEMAKER_PROJECT_NAME" --s3-bucket "$ARTIFACT_BUCKET" --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_NAME
- cat $EXPORT_TEMPLATE_STAGING_CONFIG
- cat $EXPORT_TEMPLATE_PROD_CONFIG
artifacts:
files:
- $EXPORT_TEMPLATE_NAME
- $EXPORT_TEMPLATE_STAGING_CONFIG
- $EXPORT_TEMPLATE_PROD_CONFIG