You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This template repository contains a sample application and sample GitHub Actions workflow files for continuously deploying both application code and infrastructure as code with GitHub Actions.
4
+
5
+
This MLOps workflow demonstrates training and evaluating a machine learning model to predict taxi fare from the public [New York City Taxi dataset](https://registry.opendata.aws/nyc-tlc-trip-records-pds/) deployed with Amazon SageMaker.
6
+
7
+
This repository contains a number of start workflow files for GitHub Actions:
8
+
1.[build-pipeline.yml](./build-pipeline.yml) runs when a pull request is opened or updated. This workflow creates or updates the Sagemaker Pipeline, and starts an execution.
9
+
1.[deploy-staging.yml](./deploy-staging.yml) runs when a new commit is pushed to the master branch for the `staging` environment. This workflow deploys the SageMaker endpoint for staging. (WIP)
10
+
1.[deploy-prod.yml](./deploy-prod.yml) runs when a new commit is pushed to the master branch for the `production` environment. This workflow deploys the Sagemaker endpoint for production. (WIP)
11
+
1.[publish-template.yml](./publish-template.yml) runs when a new commit is pushed to the master branch for the `public` environment. Synths and uploads the CFN templates and build & deploy assets for launching the stack.
12
+
13
+
## Create a GitHub repository from this template
14
+
15
+
Click the "Use this template" button above to create a new repository from this template.
16
+
17
+
Clone your new repository, and deploy the IAM resources needed to enable GitHub Actions to deploy CloudFormation templates:
You can review the permissions that your repository's GitHub Actions deployment workflow will have in the [setup.yml](cloudformation-templates/setup.yml) CloudFormation template.
27
+
28
+
Retrieve the IAM access key credentials that GitHub Actions will use for deployments:
29
+
```
30
+
aws secretsmanager get-secret-value \
31
+
--secret-id github-actions-sagemaker \
32
+
--region us-east-1 \
33
+
--query SecretString \
34
+
--output text
35
+
```
36
+
37
+
The GitHub Actions workflow has three stages: Model build, Deploy to staging, and Deploy to production. Each has their on [environment](https://docs.github.com/en/actions/reference/environments) which secrets and optional protection rules.
38
+
1.`development` This is the environment in which runs your Model Build and starts the SageMaker pipeline execution, and on completion it will publish a model to the Registry. It is recommend you run this on `pull_request` and `push`.
39
+
1.`staging` This second stage deploys your Staging endpoint. It is recommend you run this on commit to the `development` branch and configure a *protection rule* to continue after you have approved the model in the SageMaker Model Registry.
40
+
1.`prod` This final stage deploys you Production Endpoint. It is recommend you this on commit the `main` branch with a *protection rule* to require approval after Staging endpoint has been tested.
41
+
42
+
For each of the environments you will require setting up the following secrets.
43
+
1. Create a secret named `AWS_REGION` defaulted to region `us-east-1`
44
+
1. Create a secret named `AWS_ACCESS_KEY_ID` containing the `AccessKeyId` value returned above.
45
+
1. Create a secret named `AWS_SECRET_ACCESS_KEY` containing in the `SecretAccessKey` value returned above.
46
+
1. Create a secret named `AWS_SAGEMAKER_ROLE` containing the `SageMakerRoleArn` output in the setup stack.
47
+
48
+
If you configure *protection rules* for you environments, you will need to click **Review deployments** to approve the next stage as show below:
When the workflow successfully completes, you will have both Endpoints deployed in staging and production, with drift detection enable which will trigger re-training on drift.
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ Once complete, you can Train and Deploy machine learning models, and send traffi
15
15
16
16
Use this following AWS CloudFormation quick start to create a custom [SageMaker MLOps project](https://docs.aws.amazon.com/sagemaker/latest/dg/sagemaker-projects-templates-custom.html) template in the [AWS Service Catalog](https://aws.amazon.com/servicecatalog/) and configure the portfolio and products so you can launch the project from within your Studio domain.
0 commit comments