-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdeploy-model-dev.yml
48 lines (45 loc) · 1.54 KB
/
deploy-model-dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Description: Deploy the development Amazon SageMaker Endpoint.
Parameters:
ImageRepoUri:
Type: String
Description: Uri of the docker (ECR) model image
ModelName:
Type: String
Description: Name of the model
TrainJobId:
Type: String
Description: Id of the Codepipeline + SagemakerJobs
DeployRoleArn:
Type: String
Description: The role for executing the deployment
ModelVariant:
Type: String
Description: Name of the endpoint variant
KmsKeyId:
Description: AWS KMS key ID used to encrypt data at rest on the ML storage volume attached to endpoint config.
Type: String
Resources:
Model:
Type: "AWS::SageMaker::Model"
Properties:
ModelName: !Sub ${ModelName}-dev-${TrainJobId}
PrimaryContainer:
Image: !Ref ImageRepoUri
ModelDataUrl: !Sub s3://sagemaker-${AWS::Region}-${AWS::AccountId}/${ModelName}/${ModelName}-${TrainJobId}/output/model.tar.gz
ExecutionRoleArn: !Ref DeployRoleArn
EndpointConfig:
Type: "AWS::SageMaker::EndpointConfig"
Properties:
ProductionVariants:
- InitialInstanceCount: 1
InitialVariantWeight: 1.0
InstanceType: ml.t2.medium
ModelName: !GetAtt Model.ModelName
VariantName: !Sub ${ModelVariant}-${ModelName}
EndpointConfigName: !Sub ${ModelName}-dec-${TrainJobId}
KmsKeyId: !Ref KmsKeyId
Endpoint:
Type: "AWS::SageMaker::Endpoint"
Properties:
EndpointName: !Sub ${ModelName}-dev-${TrainJobId}
EndpointConfigName: !GetAtt EndpointConfig.EndpointConfigName