Skip to content

Instantly share code, notes, and snippets.

@sofianhamiti
Created March 14, 2021 17:31
Show Gist options
  • Save sofianhamiti/824b2a792aecc5c95c6aed8b9975922f to your computer and use it in GitHub Desktop.
Save sofianhamiti/824b2a792aecc5c95c6aed8b9975922f to your computer and use it in GitHub Desktop.
version: 0.2
phases:
install:
runtime-versions:
python: 3.8
commands:
- npm install -g [email protected]
- pip install --upgrade --force-reinstall botocore boto3 awscli
pre_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" --export-staging-config $EXPORT_TEMPLATE_STAGING_CONFIG --export-prod-config $EXPORT_TEMPLATE_PROD_CONFIG
build:
commands:
# Generate CFN template from CDK project in stack folder
- cd stack
- pip install -r requirements.txt
- cdk synth --output cdk_output --path-metadata false
- cd ../
post_build:
commands:
- aws cloudformation package --s3-bucket $ARTIFACT_BUCKET --template-file stack/cdk_output/inference.template.json --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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment