EndpointConfig L2 construct
Defines a SageMaker EndpointConfig.
Example
import * as sagemaker from '@aws-cdk/aws-sagemaker-alpha';
declare const modelA: sagemaker.Model;
declare const modelB: sagemaker.Model;
const endpointConfig = new sagemaker.EndpointConfig(this, 'EndpointConfig', {
instanceProductionVariants: [
{
model: modelA,
variantName: 'modelA',
initialVariantWeight: 2.0,
},
{
model: modelB,
variantName: 'variantB',
initialVariantWeight: 1.0,
},
]
});
import aws_cdk.aws_sagemaker_alpha as sagemaker
# model_a: sagemaker.Model
# model_b: sagemaker.Model
endpoint_config = sagemaker.EndpointConfig(self, "EndpointConfig",
instance_production_variants=[sagemaker.InstanceProductionVariantProps(
model=model_a,
variant_name="modelA",
initial_variant_weight=2
), sagemaker.InstanceProductionVariantProps(
model=model_b,
variant_name="variantB",
initial_variant_weight=1
)
]
)
import software.amazon.awscdk.services.sagemaker.alpha.*;
Model modelA;
Model modelB;
EndpointConfig endpointConfig = EndpointConfig.Builder.create(this, "EndpointConfig")
.instanceProductionVariants(List.of(InstanceProductionVariantProps.builder()
.model(modelA)
.variantName("modelA")
.initialVariantWeight(2)
.build(), InstanceProductionVariantProps.builder()
.model(modelB)
.variantName("variantB")
.initialVariantWeight(1)
.build()))
.build();
// Install: dotnet add package Amazon.CDK.AWS.Sagemaker.Alpha
using Amazon.CDK.AWS.Sagemaker.Alpha;
Model modelA;
Model modelB;
var endpointConfig = new EndpointConfig(this, "EndpointConfig", new EndpointConfigProps {
InstanceProductionVariants = new [] { new InstanceProductionVariantProps {
Model = modelA,
VariantName = "modelA",
InitialVariantWeight = 2
}, new InstanceProductionVariantProps {
Model = modelB,
VariantName = "variantB",
InitialVariantWeight = 1
} }
});
// Install: go get github.com/aws/aws-cdk-go/awscdksagemakeralpha/v2
import sagemaker "github.com/aws/aws-cdk-go/awscdksagemakeralpha"
var modelA Model
var modelB Model
endpointConfig := sagemaker.NewEndpointConfig(this, jsii.String("EndpointConfig"), &EndpointConfigProps{
InstanceProductionVariants: []InstanceProductionVariantProps{
&InstanceProductionVariantProps{
Model: modelA,
VariantName: jsii.String("modelA"),
InitialVariantWeight: jsii.Number(2),
},
&InstanceProductionVariantProps{
Model: modelB,
VariantName: jsii.String("variantB"),
InitialVariantWeight: jsii.Number(1),
},
},
})
Initializer
new EndpointConfig(scope: Construct, id: string, props?: EndpointConfigProps)
EndpointConfig(scope: Construct, id: str, props: typing.Optional[EndpointConfigProps] = None)
new EndpointConfig(Construct scope, String id, EndpointConfigProps props)
new EndpointConfig(Construct scope, string id, EndpointConfigProps? props = null)
NewEndpointConfig(Scope Construct, Id *string, Props EndpointConfigProps)
Construct Props
encryptionKeyIKeyRefencryption_keyIKeyRefencryptionKeyIKeyRefEncryptionKeyIKeyRefEncryptionKeyIKeyRef= none#endpointConfigNamestringendpoint_config_namestrendpointConfigNameStringEndpointConfigNamestringEndpointConfigName*string= AWS CloudFormation generates a u…#default
Default: AWS CloudFormation generates a unique physical ID and uses that ID for the endpoint configuration's name.
instanceProductionVariantsInstanceProductionVariantProps[]instance_production_variantstyping.List[InstanceProductionVariantProps]instanceProductionVariantsList<InstanceProductionVariantProps>InstanceProductionVariantsInstanceProductionVariantProps[]InstanceProductionVariants*[]InstanceProductionVariantProps= none#Cannot be specified if serverlessProductionVariant is specified.
serverlessProductionVariantServerlessProductionVariantPropsserverless_production_variantServerlessProductionVariantPropsserverlessProductionVariantServerlessProductionVariantPropsServerlessProductionVariantServerlessProductionVariantPropsServerlessProductionVariantServerlessProductionVariantProps= none#Cannot be specified if instanceProductionVariants is specified.
Properties
endpointConfigArnstringendpoint_config_arnstrendpointConfigArnStringEndpointConfigArnstringEndpointConfigArn*stringrequired#endpointConfigNamestringendpoint_config_namestrendpointConfigNameStringEndpointConfigNamestringEndpointConfigName*stringrequired#envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironmentrequired#notes
For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#Methods
addInstanceProductionVariant(props: InstanceProductionVariantProps): voiddef add_instance_production_variant(self, props: InstanceProductionVariantProps) -> Nonepublic void addInstanceProductionVariant(InstanceProductionVariantProps props)public void AddInstanceProductionVariant(InstanceProductionVariantProps props)func AddInstanceProductionVariant(Props InstanceProductionVariantProps)#1 parameter
Parameters
propspropspropspropsProps— The properties of a production variant to add.
addServerlessProductionVariant(props: ServerlessProductionVariantProps): voiddef add_serverless_production_variant(self, props: ServerlessProductionVariantProps) -> Nonepublic void addServerlessProductionVariant(ServerlessProductionVariantProps props)public void AddServerlessProductionVariant(ServerlessProductionVariantProps props)func AddServerlessProductionVariant(Props ServerlessProductionVariantProps)#1 parameter
Parameters
propspropspropspropsProps— The properties of a serverless production variant to add.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#notes · 1 parameter
When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#notes
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).
fromEndpointConfigArn(scope: Construct, id: string, endpointConfigArn: string): IEndpointConfig@staticmethod def from_endpoint_config_arn(scope: Construct, id: str, endpoint_config_arn: str) -> IEndpointConfigpublic static IEndpointConfig fromEndpointConfigArn(Construct scope, String id, String endpointConfigArn)public static IEndpointConfig FromEndpointConfigArn(Construct scope, string id, string endpointConfigArn)func FromEndpointConfigArn(Scope Construct, Id *string, EndpointConfigArn *string) IEndpointConfigstatic#3 parameters
Parameters
scopescopescopescopeScope— the Construct scope.ididididId— the resource id.endpointConfigArnendpoint_config_arnendpointConfigArnendpointConfigArnEndpointConfigArn— the ARN of the endpoint configuration.
fromEndpointConfigName(scope: Construct, id: string, endpointConfigName: string): IEndpointConfig@staticmethod def from_endpoint_config_name(scope: Construct, id: str, endpoint_config_name: str) -> IEndpointConfigpublic static IEndpointConfig fromEndpointConfigName(Construct scope, String id, String endpointConfigName)public static IEndpointConfig FromEndpointConfigName(Construct scope, string id, string endpointConfigName)func FromEndpointConfigName(Scope Construct, Id *string, EndpointConfigName *string) IEndpointConfigstatic#3 parameters
Parameters
scopescopescopescopeScope— the Construct scope.ididididId— the resource id.endpointConfigNameendpoint_config_nameendpointConfigNameendpointConfigNameEndpointConfigName— the name of the endpoint configuration.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.