Created
May 17, 2019 14:59
-
-
Save juliensimon/cff850677c3d8f43cb1979e902da1ae4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import boto3 | |
| trainingJobName = "xgboost-2019-05-09-15-20-51-276" | |
| print(trainingJobName) | |
| sm = boto3.client("sagemaker") | |
| job = sm.describe_training_job(TrainingJobName=trainingJobName) | |
| trainingImage = job['AlgorithmSpecification']['TrainingImage'] | |
| modelDataUrl = job['ModelArtifacts']['S3ModelArtifacts'] | |
| roleArn = job['RoleArn'] | |
| cf = boto3.client("cloudformation") | |
| with open("endpoint-one-model.yml", "r") as f: | |
| stack = cf.create_stack(StackName="endpoint-one-model", | |
| TemplateBody=f.read(), | |
| Parameters=[ | |
| {"ParameterKey":"ModelName", "ParameterValue":trainingJobName}, | |
| {"ParameterKey":"TrainingImage", "ParameterValue":trainingImage}, | |
| {"ParameterKey":"ModelDataUrl", "ParameterValue":modelDataUrl}, | |
| {"ParameterKey":"RoleArn", "ParameterValue":roleArn} ]) | |
| print(stack) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment