CfnEndpoint
- class aws_cdk.aws_sagemaker.CfnEndpoint(scope, id, *, endpoint_config_name, deployment_config=None, endpoint_name=None, exclude_retained_variant_properties=None, retain_all_variant_properties=None, retain_deployment_config=None, tags=None)
Bases:
CfnResource
A CloudFormation
AWS::SageMaker::Endpoint
.Use the
AWS::SageMaker::Endpoint
resource to create an endpoint using the specified configuration in the request. Amazon SageMaker uses the endpoint to provision resources and deploy models. You create the endpoint configuration with the AWS::SageMaker::EndpointConfig resource. For more information, see Deploy a Model on Amazon SageMaker Hosting Services in the Amazon SageMaker Developer Guide .- CloudformationResource:
AWS::SageMaker::Endpoint
- Link:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sagemaker-endpoint.html
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_sagemaker as sagemaker cfn_endpoint = sagemaker.CfnEndpoint(self, "MyCfnEndpoint", endpoint_config_name="endpointConfigName", # the properties below are optional deployment_config=sagemaker.CfnEndpoint.DeploymentConfigProperty( blue_green_update_policy=sagemaker.CfnEndpoint.BlueGreenUpdatePolicyProperty( traffic_routing_configuration=sagemaker.CfnEndpoint.TrafficRoutingConfigProperty( type="type", # the properties below are optional canary_size=sagemaker.CfnEndpoint.CapacitySizeProperty( type="type", value=123 ), linear_step_size=sagemaker.CfnEndpoint.CapacitySizeProperty( type="type", value=123 ), wait_interval_in_seconds=123 ), # the properties below are optional maximum_execution_timeout_in_seconds=123, termination_wait_in_seconds=123 ), # the properties below are optional auto_rollback_configuration=sagemaker.CfnEndpoint.AutoRollbackConfigProperty( alarms=[sagemaker.CfnEndpoint.AlarmProperty( alarm_name="alarmName" )] ) ), endpoint_name="endpointName", exclude_retained_variant_properties=[sagemaker.CfnEndpoint.VariantPropertyProperty( variant_property_type="variantPropertyType" )], retain_all_variant_properties=False, retain_deployment_config=False, tags=[CfnTag( key="key", value="value" )] )
Create a new
AWS::SageMaker::Endpoint
.- Parameters:
scope (
Construct
) –scope in which this resource is defined.
id (
str
) –scoped id of the resource.
endpoint_config_name (
str
) –The name of the AWS::SageMaker::EndpointConfig resource that specifies the configuration for the endpoint. For more information, see CreateEndpointConfig .
deployment_config (
Union
[IResolvable
,DeploymentConfigProperty
,Dict
[str
,Any
],None
]) – The deployment configuration for an endpoint, which contains the desired deployment strategy and rollback configurations.endpoint_name (
Optional
[str
]) – The name of the endpoint.The name must be unique within an AWS Region in your AWS account. The name is case-insensitive inCreateEndpoint
, but the case is preserved and must be matched in ` <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_runtime_InvokeEndpoint.html>`_ .exclude_retained_variant_properties (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,VariantPropertyProperty
,Dict
[str
,Any
]]],None
]) – When you are updating endpoint resources with RetainAllVariantProperties whose value is set totrue
,ExcludeRetainedVariantProperties
specifies the list of type VariantProperty to override with the values provided byEndpointConfig
. If you don’t specify a value forExcludeAllVariantProperties
, no variant properties are overridden. Don’t use this property when creating new endpoint resources or whenRetainAllVariantProperties
is set tofalse
.retain_all_variant_properties (
Union
[bool
,IResolvable
,None
]) – When updating endpoint resources, enables or disables the retention of variant properties, such as the instance count or the variant weight. To retain the variant properties of an endpoint when updating it, setRetainAllVariantProperties
totrue
. To use the variant properties specified in a newEndpointConfig
call when updating an endpoint, setRetainAllVariantProperties
tofalse
. Use this property only when updating endpoint resources, not when creating new endpoint resources.retain_deployment_config (
Union
[bool
,IResolvable
,None
]) – Specifies whether to reuse the last deployment configuration. The default value is false (the configuration is not reused).tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – A list of key-value pairs to apply to this resource. For more information, see Resource Tag and Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide .
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_depends_on(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
)- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
)value (
Any
)
- See:
- Return type:
None
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
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
).- Parameters:
policy (
Optional
[RemovalPolicy
])apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.
- Return type:
None
- get_att(attribute_name)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
)- See:
- Return type:
Any
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) –tree inspector to collect and process attributes.
- Return type:
None
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::SageMaker::Endpoint'
- attr_endpoint_name
The name of the endpoint, such as
MyEndpoint
.- CloudformationAttribute:
EndpointName
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- deployment_config
The deployment configuration for an endpoint, which contains the desired deployment strategy and rollback configurations.
- endpoint_config_name
The name of the AWS::SageMaker::EndpointConfig resource that specifies the configuration for the endpoint. For more information, see CreateEndpointConfig .
- endpoint_name
The name of the endpoint.The name must be unique within an AWS Region in your AWS account. The name is case-insensitive in
CreateEndpoint
, but the case is preserved and must be matched in ` <https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_runtime_InvokeEndpoint.html>`_ .
- exclude_retained_variant_properties
When you are updating endpoint resources with RetainAllVariantProperties whose value is set to
true
,ExcludeRetainedVariantProperties
specifies the list of type VariantProperty to override with the values provided byEndpointConfig
. If you don’t specify a value forExcludeAllVariantProperties
, no variant properties are overridden. Don’t use this property when creating new endpoint resources or whenRetainAllVariantProperties
is set tofalse
.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- node
The construct tree node associated with this construct.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- retain_all_variant_properties
When updating endpoint resources, enables or disables the retention of variant properties, such as the instance count or the variant weight.
To retain the variant properties of an endpoint when updating it, set
RetainAllVariantProperties
totrue
. To use the variant properties specified in a newEndpointConfig
call when updating an endpoint, setRetainAllVariantProperties
tofalse
. Use this property only when updating endpoint resources, not when creating new endpoint resources.
- retain_deployment_config
Specifies whether to reuse the last deployment configuration.
The default value is false (the configuration is not reused).
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- tags
A list of key-value pairs to apply to this resource.
For more information, see Resource Tag and Using Cost Allocation Tags in the AWS Billing and Cost Management User Guide .
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
)- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(construct)
Check whether the given construct is a CfnResource.
- Parameters:
construct (
IConstruct
)- Return type:
bool
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
)- Return type:
bool
AlarmProperty
- class CfnEndpoint.AlarmProperty(*, alarm_name)
Bases:
object
An Amazon CloudWatch alarm configured to monitor metrics on an endpoint.
- Parameters:
alarm_name (
str
) – The name of a CloudWatch alarm in your account.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_sagemaker as sagemaker alarm_property = sagemaker.CfnEndpoint.AlarmProperty( alarm_name="alarmName" )
Attributes
- alarm_name
The name of a CloudWatch alarm in your account.
AutoRollbackConfigProperty
- class CfnEndpoint.AutoRollbackConfigProperty(*, alarms)
Bases:
object
Automatic rollback configuration for handling endpoint deployment failures and recovery.
- Parameters:
alarms (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,AlarmProperty
,Dict
[str
,Any
]]]]) – List of CloudWatch alarms in your account that are configured to monitor metrics on an endpoint. If any alarms are tripped during a deployment, SageMaker rolls back the deployment.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_sagemaker as sagemaker auto_rollback_config_property = sagemaker.CfnEndpoint.AutoRollbackConfigProperty( alarms=[sagemaker.CfnEndpoint.AlarmProperty( alarm_name="alarmName" )] )
Attributes
- alarms
List of CloudWatch alarms in your account that are configured to monitor metrics on an endpoint.
If any alarms are tripped during a deployment, SageMaker rolls back the deployment.
BlueGreenUpdatePolicyProperty
- class CfnEndpoint.BlueGreenUpdatePolicyProperty(*, traffic_routing_configuration, maximum_execution_timeout_in_seconds=None, termination_wait_in_seconds=None)
Bases:
object
Update policy for a blue/green deployment.
If this update policy is specified, SageMaker creates a new fleet during the deployment while maintaining the old fleet. SageMaker flips traffic to the new fleet according to the specified traffic routing configuration. Only one update policy should be used in the deployment configuration. If no update policy is specified, SageMaker uses a blue/green deployment strategy with all at once traffic shifting by default.
- Parameters:
traffic_routing_configuration (
Union
[IResolvable
,TrafficRoutingConfigProperty
,Dict
[str
,Any
]]) – Defines the traffic routing strategy to shift traffic from the old fleet to the new fleet during an endpoint deployment.maximum_execution_timeout_in_seconds (
Union
[int
,float
,None
]) – Maximum execution timeout for the deployment. Note that the timeout value should be larger than the total waiting time specified inTerminationWaitInSeconds
andWaitIntervalInSeconds
.termination_wait_in_seconds (
Union
[int
,float
,None
]) – Additional waiting time in seconds after the completion of an endpoint deployment before terminating the old endpoint fleet. Default is 0.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_sagemaker as sagemaker blue_green_update_policy_property = sagemaker.CfnEndpoint.BlueGreenUpdatePolicyProperty( traffic_routing_configuration=sagemaker.CfnEndpoint.TrafficRoutingConfigProperty( type="type", # the properties below are optional canary_size=sagemaker.CfnEndpoint.CapacitySizeProperty( type="type", value=123 ), linear_step_size=sagemaker.CfnEndpoint.CapacitySizeProperty( type="type", value=123 ), wait_interval_in_seconds=123 ), # the properties below are optional maximum_execution_timeout_in_seconds=123, termination_wait_in_seconds=123 )
Attributes
- maximum_execution_timeout_in_seconds
Maximum execution timeout for the deployment.
Note that the timeout value should be larger than the total waiting time specified in
TerminationWaitInSeconds
andWaitIntervalInSeconds
.
- termination_wait_in_seconds
Additional waiting time in seconds after the completion of an endpoint deployment before terminating the old endpoint fleet.
Default is 0.
- traffic_routing_configuration
Defines the traffic routing strategy to shift traffic from the old fleet to the new fleet during an endpoint deployment.
CapacitySizeProperty
- class CfnEndpoint.CapacitySizeProperty(*, type, value)
Bases:
object
Specifies the endpoint capacity to activate for production.
- Parameters:
type (
str
) – Specifies the endpoint capacity type. -INSTANCE_COUNT
: The endpoint activates based on the number of instances. -CAPACITY_PERCENT
: The endpoint activates based on the specified percentage of capacity.value (
Union
[int
,float
]) – Defines the capacity size, either as a number of instances or a capacity percentage.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_sagemaker as sagemaker capacity_size_property = sagemaker.CfnEndpoint.CapacitySizeProperty( type="type", value=123 )
Attributes
- type
Specifies the endpoint capacity type.
INSTANCE_COUNT
: The endpoint activates based on the number of instances.CAPACITY_PERCENT
: The endpoint activates based on the specified percentage of capacity.
- value
Defines the capacity size, either as a number of instances or a capacity percentage.
DeploymentConfigProperty
- class CfnEndpoint.DeploymentConfigProperty(*, blue_green_update_policy, auto_rollback_configuration=None)
Bases:
object
The deployment configuration for an endpoint, which contains the desired deployment strategy and rollback configurations.
- Parameters:
blue_green_update_policy (
Union
[IResolvable
,BlueGreenUpdatePolicyProperty
,Dict
[str
,Any
]]) – Update policy for a blue/green deployment. If this update policy is specified, SageMaker creates a new fleet during the deployment while maintaining the old fleet. SageMaker flips traffic to the new fleet according to the specified traffic routing configuration. Only one update policy should be used in the deployment configuration. If no update policy is specified, SageMaker uses a blue/green deployment strategy with all at once traffic shifting by default.auto_rollback_configuration (
Union
[IResolvable
,AutoRollbackConfigProperty
,Dict
[str
,Any
],None
]) – Automatic rollback configuration for handling endpoint deployment failures and recovery.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_sagemaker as sagemaker deployment_config_property = sagemaker.CfnEndpoint.DeploymentConfigProperty( blue_green_update_policy=sagemaker.CfnEndpoint.BlueGreenUpdatePolicyProperty( traffic_routing_configuration=sagemaker.CfnEndpoint.TrafficRoutingConfigProperty( type="type", # the properties below are optional canary_size=sagemaker.CfnEndpoint.CapacitySizeProperty( type="type", value=123 ), linear_step_size=sagemaker.CfnEndpoint.CapacitySizeProperty( type="type", value=123 ), wait_interval_in_seconds=123 ), # the properties below are optional maximum_execution_timeout_in_seconds=123, termination_wait_in_seconds=123 ), # the properties below are optional auto_rollback_configuration=sagemaker.CfnEndpoint.AutoRollbackConfigProperty( alarms=[sagemaker.CfnEndpoint.AlarmProperty( alarm_name="alarmName" )] ) )
Attributes
- auto_rollback_configuration
Automatic rollback configuration for handling endpoint deployment failures and recovery.
- blue_green_update_policy
Update policy for a blue/green deployment.
If this update policy is specified, SageMaker creates a new fleet during the deployment while maintaining the old fleet. SageMaker flips traffic to the new fleet according to the specified traffic routing configuration. Only one update policy should be used in the deployment configuration. If no update policy is specified, SageMaker uses a blue/green deployment strategy with all at once traffic shifting by default.
TrafficRoutingConfigProperty
- class CfnEndpoint.TrafficRoutingConfigProperty(*, type, canary_size=None, linear_step_size=None, wait_interval_in_seconds=None)
Bases:
object
Defines the traffic routing strategy during an endpoint deployment to shift traffic from the old fleet to the new fleet.
- Parameters:
type (
str
) – Traffic routing strategy type. -ALL_AT_ONCE
: Endpoint traffic shifts to the new fleet in a single step. -CANARY
: Endpoint traffic shifts to the new fleet in two steps. The first step is the canary, which is a small portion of the traffic. The second step is the remainder of the traffic. -LINEAR
: Endpoint traffic shifts to the new fleet in n steps of a configurable size.canary_size (
Union
[IResolvable
,CapacitySizeProperty
,Dict
[str
,Any
],None
]) – Batch size for the first step to turn on traffic on the new endpoint fleet.Value
must be less than or equal to 50% of the variant’s total instance count.linear_step_size (
Union
[IResolvable
,CapacitySizeProperty
,Dict
[str
,Any
],None
]) – Batch size for each step to turn on traffic on the new endpoint fleet.Value
must be 10-50% of the variant’s total instance count.wait_interval_in_seconds (
Union
[int
,float
,None
]) – The waiting time (in seconds) between incremental steps to turn on traffic on the new endpoint fleet.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_sagemaker as sagemaker traffic_routing_config_property = sagemaker.CfnEndpoint.TrafficRoutingConfigProperty( type="type", # the properties below are optional canary_size=sagemaker.CfnEndpoint.CapacitySizeProperty( type="type", value=123 ), linear_step_size=sagemaker.CfnEndpoint.CapacitySizeProperty( type="type", value=123 ), wait_interval_in_seconds=123 )
Attributes
- canary_size
Batch size for the first step to turn on traffic on the new endpoint fleet.
Value
must be less than or equal to 50% of the variant’s total instance count.
- linear_step_size
Batch size for each step to turn on traffic on the new endpoint fleet.
Value
must be 10-50% of the variant’s total instance count.
- type
Traffic routing strategy type.
ALL_AT_ONCE
: Endpoint traffic shifts to the new fleet in a single step.CANARY
: Endpoint traffic shifts to the new fleet in two steps. The first step is the canary, which is a small portion of the traffic. The second step is the remainder of the traffic.LINEAR
: Endpoint traffic shifts to the new fleet in n steps of a configurable size.
- wait_interval_in_seconds
The waiting time (in seconds) between incremental steps to turn on traffic on the new endpoint fleet.
VariantPropertyProperty
- class CfnEndpoint.VariantPropertyProperty(*, variant_property_type=None)
Bases:
object
Specifies a production variant property type for an Endpoint.
If you are updating an Endpoint with the RetainAllVariantProperties option set to
true
, theVarientProperty
objects listed in ExcludeRetainedVariantProperties override the existing variant properties of the Endpoint.- Parameters:
variant_property_type (
Optional
[str
]) –The type of variant property. The supported values are:. -
DesiredInstanceCount
: Overrides the existing variant instance counts using the InitialInstanceCount values in the ProductionVariants . -DesiredWeight
: Overrides the existing variant weights using the InitialVariantWeight values in the ProductionVariants . -DataCaptureConfig
: (Not currently supported.)- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_sagemaker as sagemaker variant_property_property = sagemaker.CfnEndpoint.VariantPropertyProperty( variant_property_type="variantPropertyType" )
Attributes
- variant_property_type
.
DesiredInstanceCount
: Overrides the existing variant instance counts using the InitialInstanceCount values in the ProductionVariants .DesiredWeight
: Overrides the existing variant weights using the InitialVariantWeight values in the ProductionVariants .DataCaptureConfig
: (Not currently supported.)
- Link:
- Type:
The type of variant property. The supported values are