Skip to content

Instantly share code, notes, and snippets.

@juliensimon
Created May 17, 2019 14:59
Show Gist options
  • Select an option

  • Save juliensimon/cff850677c3d8f43cb1979e902da1ae4 to your computer and use it in GitHub Desktop.

Select an option

Save juliensimon/cff850677c3d8f43cb1979e902da1ae4 to your computer and use it in GitHub Desktop.
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