https://github.com/getindata/mlflow-appengine-terraform
Terraform module for deploying MLflow on Google Cloud AppEngine Flexible
https://github.com/getindata/mlflow-appengine-terraform
Last synced: 3 months ago
JSON representation
Terraform module for deploying MLflow on Google Cloud AppEngine Flexible
- Host: GitHub
- URL: https://github.com/getindata/mlflow-appengine-terraform
- Owner: getindata
- License: apache-2.0
- Created: 2022-06-10T12:51:09.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-16T11:37:58.000Z (about 3 years ago)
- Last Synced: 2025-06-17T05:40:18.605Z (12 months ago)
- Language: HCL
- Size: 11.7 KB
- Stars: 2
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MLFlow on AppEngine
This module deploys MLFlow app on App Engine Flex with IAP authorization.
## Installation
Follow the related blog post on GetInData's official site:
[https://getindata.com/blog/deploying-mlflow-google-cloud-platform-using-app-engine/](https://getindata.com/blog/deploying-mlflow-google-cloud-platform-using-app-engine/)
## Authorizing to MLFlow via IAP
### As a user
Users need to have `IAP-secured Web App User` role in the project or on the specific IAP resource level.
### As a service account
#### Using bash
1. Service account needs to have the following roles:
1. `IAP-secured Web App User`
2. `Service Account Token Creator`
2. Obtaining authorization token via curl:
```bash
export TOKEN=$(curl -s -X POST -H "content-type: application/json" -H "Authorization: Bearer $(gcloud auth print-access-token)" -d "{\"audience\": \"${_IAP_CLIENT_ID}\", \"includeEmail\": true }" "https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/$(gcloud auth list --filter=status:ACTIVE --format='value(account)'):generateIdToken" | jq -r '.token')
```
3. Sending the request:
```bash
curl -X GET https://.appspot.com/api/2.0/mlflow/experiments/list -H "Authorization: Bearer ${TOKEN}"
```
#### Using Python
1. Make sure that `google-cloud-iam` package is installed
2. Use the following code
```python
from google.cloud import iam_credentials
import requests
client = iam_credentials.IAMCredentialsClient()
sa = ""
client_id = ""
token = client.generate_id_token(
name=f"projects/-/serviceAccounts/{sa}",
audience=client_id,
include_email=True,
).token
result = requests.get("https://.appspot.com/api/2.0/mlflow/experiments/list",
headers={"Authorization": f"Bearer {token}"})
print(result.json())
```