{"id":7935,"date":"2025-10-22T11:01:53","date_gmt":"2025-10-22T11:01:53","guid":{"rendered":"https:\/\/techtrendfeed.com\/?p=7935"},"modified":"2025-10-22T11:01:53","modified_gmt":"2025-10-22T11:01:53","slug":"serverless-deployment-on-your-amazon-sagemaker-canvas-fashions","status":"publish","type":"post","link":"https:\/\/techtrendfeed.com\/?p=7935","title":{"rendered":"Serverless deployment on your Amazon SageMaker Canvas fashions"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div id=\"\">\n<p>Deploying machine studying (ML) fashions into manufacturing can usually be a fancy and resource-intensive process, particularly for purchasers with out deep ML and DevOps experience. <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/aws.amazon.com\/sagemaker-ai\/canvas\/\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon SageMaker Canvas<\/a> simplifies mannequin constructing by providing a no-code interface, so you&#8217;ll be able to create extremely correct ML fashions utilizing your current knowledge sources and with out writing a single line of code. However constructing a mannequin is just half the journey; deploying it effectively and cost-effectively is simply as essential. <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/docs.aws.amazon.com\/sagemaker\/latest\/dg\/serverless-endpoints.html\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon SageMaker Serverless Inference<\/a> is designed for workloads with variable visitors patterns and idle intervals. It robotically provisions and scales infrastructure based mostly on demand, assuaging the necessity to handle servers or pre-configure capability.<\/p>\n<p>On this publish, we stroll by how you can take an ML mannequin inbuilt SageMaker Canvas and deploy it utilizing SageMaker Serverless Inference. This answer may help you go from mannequin creation to production-ready predictions shortly, effectively, and with out managing any infrastructure.<\/p>\n<h2>Answer overview<\/h2>\n<p>To exhibit serverless endpoint creation for a SageMaker Canvas educated mannequin, let\u2019s discover an instance workflow:<\/p>\n<ol>\n<li>Add the educated mannequin to the <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/docs.aws.amazon.com\/sagemaker\/latest\/dg\/model-registry.html\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon SageMaker Mannequin Registry<\/a>.<\/li>\n<li>Create a brand new SageMaker mannequin with the right configuration.<\/li>\n<li>Create a serverless endpoint configuration.<\/li>\n<li>Deploy the serverless endpoint with the created mannequin and endpoint configuration.<\/li>\n<\/ol>\n<p>You can even automate the method, as illustrated within the following diagram.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-116373 size-full\" style=\"margin: 10px 0px 10px 0px;border: 1px solid #CCCCCC\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2025\/09\/15\/ml-18479-1.jpeg\" alt=\"Solution architecture\" width=\"1289\" height=\"379\"\/><\/p>\n<p>On this instance, we deploy a pre-trained regression mannequin to a serverless SageMaker endpoint. This manner, we will use our mannequin for variable workloads that don\u2019t require real-time inference.<\/p>\n<h3>Stipulations<\/h3>\n<p>As a prerequisite, you could have entry to <a rel=\"nofollow\" target=\"_blank\" href=\"http:\/\/aws.amazon.com\/s3\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon Easy Storage Service<\/a> (Amazon S3) and <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/aws.amazon.com\/sagemaker\/\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon SageMaker AI<\/a>. In the event you don\u2019t have already got a SageMaker AI area configured in your account, you additionally want permissions to <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/docs.aws.amazon.com\/sagemaker\/latest\/dg\/gs.html\" target=\"_blank\" rel=\"noopener noreferrer\">create a SageMaker AI area<\/a>.<\/p>\n<p>You have to even have a regression or classification mannequin that you&#8217;ve got educated. You may practice your SageMaker Canvas mannequin as you usually would. This consists of creating the <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/aws.amazon.com\/sagemaker\/data-wrangler\/\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon SageMaker Knowledge Wrangler<\/a> circulate, performing vital knowledge transformations, and selecting the mannequin coaching configuration. In the event you don\u2019t have already got a educated mannequin, you&#8217;ll be able to comply with one of many labs within the <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/catalog.us-east-1.prod.workshops.aws\/workshops\/80ba0ea5-7cf9-4b8c-9d3f-1cd988b6c071\/en-US\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon SageMaker Canvas Immersion Day<\/a> to create one earlier than persevering with. For this instance, we use a classification mannequin that was educated on the <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/docs.aws.amazon.com\/sagemaker\/latest\/dg\/canvas-sample-datasets.html\" target=\"_blank\" rel=\"noopener noreferrer\">canvas-sample-shipping-logs.csv pattern dataset<\/a>.<\/p>\n<h2>Save your mannequin to the SageMaker Mannequin Registry<\/h2>\n<p>Full the next steps to avoid wasting your mannequin to the SageMaker Mannequin Registry:<\/p>\n<ol>\n<li>On the SageMaker AI console, select <strong>Studio<\/strong> to launch <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/aws.amazon.com\/sagemaker\/studio\/\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon SageMaker Studio<\/a>.<\/li>\n<li>Within the SageMaker Studio interface, launch SageMaker Canvas, which is able to open in a brand new tab.<\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-116376\" style=\"margin: 10px 0px 10px 0px;border: 1px solid #CCCCCC\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2025\/09\/15\/open_canvas_final.gif\" alt=\"Open SageMaker Studio\" width=\"1280\" height=\"720\"\/><\/p>\n<ol start=\"3\">\n<li>Find the mannequin and mannequin model that you just need to deploy to your serverless endpoint.<\/li>\n<li>On the choices menu (three vertical dots), select <strong>Add to Mannequin Registry<\/strong>.<\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-117206\" style=\"margin: 10px 0px 10px 0px;border: 1px solid #CCCCCC\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2025\/09\/26\/save_to_mr-2.gif\" alt=\"Save to model registry\" width=\"1920\" height=\"1080\"\/><\/p>\n<p>Now you can exit SageMaker Canvas by logging out. To handle prices and forestall extra <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/aws.amazon.com\/sagemaker-ai\/canvas\/pricing\/\" target=\"_blank\" rel=\"noopener noreferrer\">workspace costs<\/a>, you may also configure SageMaker Canvas to <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/docs.aws.amazon.com\/sagemaker\/latest\/dg\/canvas-log-out.html#canvas-auto-shutdown\" target=\"_blank\" rel=\"noopener noreferrer\">robotically shut down when idle<\/a>.<\/p>\n<h2>Approve your mannequin for deployment<\/h2>\n<p>After you may have added your mannequin to the Mannequin Registry, full the next steps:<\/p>\n<ol>\n<li>Within the SageMaker Studio UI, select <strong>Fashions<\/strong> within the navigation pane.<\/li>\n<\/ol>\n<p>The mannequin you simply exported from SageMaker Canvas needs to be added with a deployment standing of <strong>Pending guide approval<\/strong>.<\/p>\n<ol start=\"2\">\n<li>Select the mannequin model you need to deploy and replace the standing to <strong>Permitted <\/strong>by selecting the deployment standing.<\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-117208\" style=\"margin: 10px 0px 10px 0px;border: 1px solid #CCCCCC\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2025\/09\/26\/find_deploy_tab-1.gif\" alt=\"Find deploy tab\" width=\"1920\" height=\"1080\"\/><\/p>\n<ol start=\"3\">\n<li>Select the mannequin model and navigate to the <strong>Deploy<\/strong> tab. That is the place you will discover the data associated to the mannequin and related container.<\/li>\n<li>Choose the container and mannequin location associated to the educated mannequin. You may determine it by checking the presence of the setting variable <code>SAGEMAKER_DEFAULT_INVOCATIONS_ACCEPT<\/code>.<\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-117199 size-full\" style=\"margin: 10px 0px 10px 0px;border: 1px solid #CCCCCC\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2025\/09\/26\/ml-18479-5.png\" alt=\"ECR and S3 URIs\" width=\"1619\" height=\"360\"\/><\/p>\n<h2>Create a brand new mannequin<\/h2>\n<p>Full the next steps to create a brand new mannequin:<\/p>\n<ol>\n<li>With out closing the SageMaker Studio tab, open a brand new tab and open the SageMaker AI console.<\/li>\n<li>Select <strong>Fashions <\/strong>within the <strong>Inference<\/strong> part and select <strong>Create mannequin<\/strong>.<\/li>\n<li>Title your mannequin.<\/li>\n<li>Go away the container enter possibility as <strong>Present mannequin artifacts and inference picture location<\/strong> and used the <code>CompressedModel<\/code> sort.<\/li>\n<li>Enter the <a rel=\"nofollow\" target=\"_blank\" href=\"http:\/\/aws.amazon.com\/ecr\/\" target=\"_blank\" rel=\"noopener noreferrer\">Amazon Elastic Container Registry<\/a> (Amazon ECR) URI, Amazon S3 URI, and setting variables that you just positioned within the earlier step.<\/li>\n<\/ol>\n<p>The setting variables can be proven as a single line in SageMaker Studio, with the next format:<\/p>\n<div class=\"hide-language\">\n<pre><code class=\"lang-code\">SAGEMAKER_DEFAULT_INVOCATIONS_ACCEPT: textual content\/csv, SAGEMAKER_INFERENCE_OUTPUT: predicted_label, SAGEMAKER_INFERENCE_SUPPORTED: predicted_label, SAGEMAKER_PROGRAM: tabular_serve.py, SAGEMAKER_SUBMIT_DIRECTORY: \/decide\/ml\/mannequin\/code<\/code><\/pre>\n<\/p><\/div>\n<p>You might need totally different variables than these within the previous instance. All variables out of your setting variables needs to be added to your mannequin. Make it possible for every setting variable is by itself line when creating you new mannequin.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-117209 size-full\" style=\"margin: 10px 0px 10px 0px;border: 1px solid #CCCCCC\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2025\/09\/26\/Screenshot-2025-09-26-at-11.15.35.png\" alt=\"Model Environment Variables\" width=\"1529\" height=\"742\"\/><\/p>\n<ol start=\"6\">\n<li>Select <strong>Create mannequin<\/strong>.<\/li>\n<\/ol>\n<h2>Create an endpoint configuration<\/h2>\n<p>Full the next steps to create an endpoint configuration:<\/p>\n<ol>\n<li>On the SageMaker AI console, select <strong>Endpoint configurations<\/strong> to create a brand new mannequin endpoint configuration.<\/li>\n<li>Set the kind of endpoint to <strong>Serverless<\/strong> and set the mannequin variant to the mannequin created within the earlier step.<\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-117201\" style=\"margin: 10px 0px 10px 0px;border: 1px solid #CCCCCC\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2025\/09\/26\/ml-18479-7.jpeg\" alt=\"Model endpoint configuration\" width=\"1287\" height=\"911\"\/><\/p>\n<ol start=\"3\">\n<li>Select <strong>Create endpoint configuration<\/strong>.<\/li>\n<\/ol>\n<h2>Create an endpoint<\/h2>\n<p>Full the next steps to create an endpoint:<\/p>\n<ol>\n<li>On the SageMaker AI console, select <strong>Endpoints<\/strong> within the navigation pane and create a brand new endpoint.<\/li>\n<li>Title the endpoint.<\/li>\n<li>Choose the endpoint configuration created within the earlier step and select <strong>Choose endpoint configuration<\/strong>.<\/li>\n<li>Select <strong>Create endpoint<\/strong>.<\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-117202\" style=\"margin: 10px 0px 10px 0px;border: 1px solid #CCCCCC\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2025\/09\/26\/ml-18479-8.jpg\" alt=\"Model endpoint creation\" width=\"1576\" height=\"1496\"\/><\/p>\n<p>The endpoint would possibly take a couple of minutes to be created. When the standing is up to date to <strong>InService<\/strong>, you&#8217;ll be able to start calling the endpoint.<\/p>\n<p>The next pattern code demonstrates how one can name an endpoint from a Jupyter pocket book positioned in your SageMaker Studio setting:<\/p>\n<div class=\"hide-language\">\n<pre><code class=\"lang-python\">import boto3\nimport csv\nfrom io import StringIO\nimport time\n\ndef invoke_shipping_prediction(options):\n    sagemaker_client = boto3.consumer('sagemaker-runtime')\n    \n    # Convert to CSV string format\n    output = StringIO()\n    csv.author(output).writerow(options)\n    payload = output.getvalue()\n    \n    response = sagemaker_client.invoke_endpoint(\n        EndpointName=\"canvas-shipping-data-model-1-serverless-endpoint\",\n        ContentType=\"textual content\/csv\",\n        Settle for=\"textual content\/csv\",\n        Physique=payload\n    )\n    \n    response_body = response['Body'].learn().decode()\n    reader = csv.reader(StringIO(response_body))\n    outcome = checklist(reader)[0]  # Get first row\n    \n    # Parse the response right into a extra usable format\n    prediction = {\n        'predicted_label': outcome[0],\n        'confidence': float(outcome[1]),\n        'class_probabilities': eval(outcome[2]),  \n        'possible_labels': eval(outcome[3])       \n    }\n    \n    return prediction\n\n# Options for inference\nfeatures_set_1 = [\n    \"Bell\",\n    \"Base\",\n    14,\n    6,\n    11,\n    11,\n    \"GlobalFreight\",\n    \"Bulk Order\",\n    \"Atlanta\",\n    \"2020-09-11 00:00:00\",\n    \"Express\",\n    109.25199890136719\n]\n\nfeatures_set_2 = [\n    \"Bell\",\n    \"Base\",\n    14,\n    6,\n    15,\n    15,\n    \"MicroCarrier\",\n    \"Single Order\",\n    \"Seattle\",\n    \"2021-06-22 00:00:00\",\n    \"Standard\",\n    155.0483856201172\n]\n\n# Invoke the SageMaker endpoint for function set 1\nstart_time = time.time()\noutcome = invoke_shipping_prediction(features_set_1)\n\n# Print Output and Timing\nend_time = time.time()\ntotal_time = end_time - start_time\n\nprint(f\"Whole response time with endpoint chilly begin: {total_time:.3f} seconds\")\nprint(f\"Prediction for function set 1: {outcome['predicted_label']}\")\nprint(f\"Confidence for function set 1: {outcome['confidence']*100:.2f}%\")\nprint(\"nProbabilities for function set 1:\")\nfor label, prob in zip(outcome['possible_labels'], outcome['class_probabilities']):\n    print(f\"{label}: {prob*100:.2f}%\")\n\n\nprint(\"---------------------------------------------------------\")\n\n# Invoke the SageMaker endpoint for function set 2\nstart_time = time.time()\noutcome = invoke_shipping_prediction(features_set_2)\n\n# Print Output and Timing\nend_time = time.time()\ntotal_time = end_time - start_time\n\nprint(f\"Whole response time with heat endpoint: {total_time:.3f} seconds\")\nprint(f\"Prediction for function set 2: {outcome['predicted_label']}\")\nprint(f\"Confidence for function set 2: {outcome['confidence']*100:.2f}%\")\nprint(\"nProbabilities for function set 2:\")\nfor label, prob in zip(outcome['possible_labels'], outcome['class_probabilities']):\n    print(f\"{label}: {prob*100:.2f}%\")\n<\/code><\/pre>\n<\/p><\/div>\n<h2>Automate the method<\/h2>\n<p>To robotically create serverless endpoints every time a brand new mannequin is authorised, you should utilize the next YAML file with <a rel=\"nofollow\" target=\"_blank\" href=\"http:\/\/aws.amazon.com\/cloudformation\" target=\"_blank\" rel=\"noopener noreferrer\">AWS CloudFormation<\/a>. This file will automate the creation of SageMaker endpoints with the configuration you specify.<\/p>\n<p>This pattern CloudFormation template is offered solely for inspirational functions and isn&#8217;t meant for direct manufacturing use. Builders ought to totally check this template based on their group\u2019s safety tips earlier than deployment.<\/p>\n<div class=\"hide-language\">\n<pre><code class=\"lang-yaml\">AWSTemplateFormatVersion: \"2010-09-09\"\nDescription: Template for creating Lambda perform to deal with SageMaker mannequin\n  package deal state adjustments and create serverless endpoints\n\nParameters:\n  MemorySizeInMB:\n    Sort: Quantity\n    Default: 1024\n    Description: Reminiscence measurement in MB for the serverless endpoint (between 1024 and 6144)\n    MinValue: 1024\n    MaxValue: 6144\n\n  MaxConcurrency:\n    Sort: Quantity\n    Default: 20\n    Description: Most variety of concurrent invocations for the serverless endpoint\n    MinValue: 1\n    MaxValue: 200\n\n  AllowedRegion:\n    Sort: String\n    Default: \"us-east-1\"\n    Description: AWS area the place SageMaker assets might be created\n\n  AllowedDomainId:\n    Sort: String\n    Description: SageMaker Studio area ID that may set off deployments\n    NoEcho: true\n\n  AllowedDomainIdParameterName:\n    Sort: String\n    Default: \"\/sagemaker\/serverless-deployment\/allowed-domain-id\"\n    Description: SSM Parameter title containing the SageMaker Studio area ID that may set off deployments\n\nAssets:\n  AllowedDomainIdParameter:\n    Sort: AWS::SSM::Parameter\n    Properties:\n      Title: !Ref AllowedDomainIdParameterName\n      Sort: String\n      Worth: !Ref AllowedDomainId\n      Description: SageMaker Studio area ID that may set off deployments\n\n  SageMakerAccessPolicy:\n    Sort: AWS::IAM::ManagedPolicy\n    Properties:\n      Description: Managed coverage for SageMaker serverless endpoint creation\n      PolicyDocument:\n        Model: \"2012-10-17\"\n        Assertion:\n          - Impact: Enable\n            Motion:\n              - sagemaker:CreateModel\n              - sagemaker:CreateEndpointConfig\n              - sagemaker:CreateEndpoint\n              - sagemaker:DescribeModel\n              - sagemaker:DescribeEndpointConfig\n              - sagemaker:DescribeEndpoint\n              - sagemaker:DeleteModel\n              - sagemaker:DeleteEndpointConfig\n              - sagemaker:DeleteEndpoint\n            Useful resource: !Sub \"arn:aws:sagemaker:${AllowedRegion}:${AWS::AccountId}:*\"\n          - Impact: Enable\n            Motion:\n              - sagemaker:DescribeModelPackage\n            Useful resource: !Sub \"arn:aws:sagemaker:${AllowedRegion}:${AWS::AccountId}:model-package\/*\/*\"\n          - Impact: Enable\n            Motion:\n              - iam:PassRole\n            Useful resource: !Sub \"arn:aws:iam::${AWS::AccountId}:function\/service-role\/AmazonSageMaker-ExecutionRole-*\"\n            Situation:\n              StringEquals:\n                \"iam:PassedToService\": \"sagemaker.amazonaws.com\"\n          - Impact: Enable\n            Motion:\n              - ssm:GetParameter\n            Useful resource: !Sub \"arn:aws:ssm:${AllowedRegion}:${AWS::AccountId}:parameter${AllowedDomainIdParameterName}\"\n\n  LambdaExecutionRole:\n    Sort: AWS::IAM::Function\n    Properties:\n      AssumeRolePolicyDocument:\n        Model: \"2012-10-17\"\n        Assertion:\n          - Impact: Enable\n            Principal:\n              Service: lambda.amazonaws.com\n            Motion: sts:AssumeRole\n      ManagedPolicyArns:\n        - arn:aws:iam::aws:coverage\/service-role\/AWSLambdaBasicExecutionRole\n        - !Ref SageMakerAccessPolicy\n\n  ModelDeploymentFunction:\n    Sort: AWS::Lambda::Operate\n    Properties:\n      Handler: index.handler\n      Function: !GetAtt LambdaExecutionRole.Arn\n      Code:\n        ZipFile: |\n          import os\n          import json\n          import boto3\n\n          sagemaker_client = boto3.consumer('sagemaker')\n          ssm_client = boto3.consumer('ssm')\n\n          def handler(occasion, context):\n              print(f\"Acquired occasion: {json.dumps(occasion, indent=2)}\")\n              attempt:\n                  # Get particulars immediately from the occasion\n                  element = occasion['detail']\n                  print(f'element: {element}')\n                  \n                  # Get allowed area ID from SSM Parameter Retailer\n                  parameter_name = os.environ.get('ALLOWED_DOMAIN_ID_PARAMETER_NAME')\n                  attempt:\n                      response = ssm_client.get_parameter(Title=parameter_name)\n                      allowed_domain = response['Parameter']['Value']\n                  besides Exception as e:\n                      print(f\"Error retrieving parameter {parameter_name}: {str(e)}\")\n                      allowed_domain = '*'  # Default fallback\n                  \n                  # Examine if area ID is allowed\n                  if allowed_domain != '*':\n                      created_by_domain = element.get('CreatedBy', {}).get('DomainId')\n                      if created_by_domain != allowed_domain:\n                          print(f\"Area {created_by_domain} not allowed. Allowed: {allowed_domain}\")\n                          return {'statusCode': 403, 'physique': 'Area not licensed'}\n\n                  # Get the mannequin package deal ARN from the occasion assets\n                  model_package_arn = occasion['resources'][0]\n\n                  # Get the mannequin package deal particulars from SageMaker\n                  model_package_response = sagemaker_client.describe_model_package(\n                      ModelPackageName=model_package_arn\n                  )\n\n                  # Parse mannequin title and model from ModelPackageName\n                  model_name, model = element['ModelPackageName'].cut up('\/')\n                  serverless_model_name = f\"{model_name}-{model}-serverless\"\n\n                  # Get all container particulars immediately from the occasion\n                  container_defs = element['InferenceSpecification']['Containers']\n\n                  # Get the execution function from the occasion and convert to correct IAM function ARN format\n                  assumed_role_arn = element['CreatedBy']['IamIdentity']['Arn']\n                  execution_role_arn = assumed_role_arn.substitute(':sts:', ':iam:')\n                                                   .substitute('assumed-role', 'function\/service-role')\n                                                   .rsplit('\/', 1)[0]\n\n                  # Put together containers configuration for the mannequin\n                  containers = []\n                  for i, container_def in enumerate(container_defs):\n                      # Get setting variables from the mannequin package deal for this container\n                      environment_vars = model_package_response['InferenceSpecification']['Containers'][i].get('Setting', {}) or {}\n                      \n                      containers.append({\n                          'Picture': container_def['Image'],\n                          'ModelDataUrl': container_def['ModelDataUrl'],\n                          'Setting': environment_vars\n                      })\n\n                  # Create mannequin with all containers\n                  if len(containers) == 1:\n                      # Use PrimaryContainer if there's just one container\n                      create_model_response = sagemaker_client.create_model(\n                          ModelName=serverless_model_name,\n                          PrimaryContainer=containers[0],\n                          ExecutionRoleArn=execution_role_arn\n                      )\n                  else:\n                      # Use Containers parameter for a number of containers\n                      create_model_response = sagemaker_client.create_model(\n                          ModelName=serverless_model_name,\n                          Containers=containers,\n                          ExecutionRoleArn=execution_role_arn\n                      )\n\n                  # Create endpoint config\n                  endpoint_config_name = f\"{serverless_model_name}-config\"\n                  create_endpoint_config_response = sagemaker_client.create_endpoint_config(\n                      EndpointConfigName=endpoint_config_name,\n                      ProductionVariants=[{\n                          'VariantName': 'AllTraffic',\n                          'ModelName': serverless_model_name,\n                          'ServerlessConfig': {\n                              'MemorySizeInMB': int(os.environ.get('MEMORY_SIZE_IN_MB')),\n                              'MaxConcurrency': int(os.environ.get('MAX_CONCURRENT_INVOCATIONS'))\n                          }\n                      }]\n                  )\n\n                  # Create endpoint\n                  endpoint_name = f\"{serverless_model_name}-endpoint\"\n                  create_endpoint_response = sagemaker_client.create_endpoint(\n                      EndpointName=endpoint_name,\n                      EndpointConfigName=endpoint_config_name\n                  )\n\n                  return {\n                      'statusCode': 200,\n                      'physique': json.dumps({\n                          'message': 'Serverless endpoint deployment initiated',\n                          'endpointName': endpoint_name\n                      })\n                  }\n\n              besides Exception as e:\n                  print(f\"Error: {str(e)}\")\n                  increase\n      Runtime: python3.12\n      Timeout: 300\n      MemorySize: 128\n      Setting:\n        Variables:\n          MEMORY_SIZE_IN_MB: !Ref MemorySizeInMB\n          MAX_CONCURRENT_INVOCATIONS: !Ref MaxConcurrency\n          ALLOWED_DOMAIN_ID_PARAMETER_NAME: !Ref AllowedDomainIdParameterName\n\n  EventRule:\n    Sort: AWS::Occasions::Rule\n    Properties:\n      Description: Rule to set off Lambda when SageMaker Mannequin Package deal state adjustments\n      EventPattern:\n        supply:\n          - aws.sagemaker\n        detail-type:\n          - SageMaker Mannequin Package deal State Change\n        element:\n          ModelApprovalStatus:\n            - Permitted\n          UpdatedModelPackageFields:\n            - ModelApprovalStatus\n      State: ENABLED\n      Targets:\n        - Arn: !GetAtt ModelDeploymentFunction.Arn\n          Id: ModelDeploymentFunction\n\n  LambdaInvokePermission:\n    Sort: AWS::Lambda::Permission\n    Properties:\n      FunctionName: !Ref ModelDeploymentFunction\n      Motion: lambda:InvokeFunction\n      Principal: occasions.amazonaws.com\n      SourceArn: !GetAtt EventRule.Arn\n\nOutputs:\n  LambdaFunctionArn:\n    Description: ARN of the Lambda perform\n    Worth: !GetAtt ModelDeploymentFunction.Arn\n  EventRuleArn:\n    Description: ARN of the EventBridge rule\n    Worth: !GetAtt EventRule.Arn\n<\/code><\/pre>\n<\/p><\/div>\n<p>This stack will restrict automated serverless endpoint creation to a particular AWS Area and area. You will discover your area ID when accessing SageMaker Studio from the SageMaker AI console, or by operating the next command: <code>aws sagemaker list-domains \u2014area [your-region]<\/code><\/p>\n<h2>Clear up<\/h2>\n<p>To handle prices and forestall extra <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/aws.amazon.com\/sagemaker-ai\/canvas\/pricing\/\" target=\"_blank\" rel=\"noopener noreferrer\">workspace costs<\/a>, just remember to have logged out of SageMaker Canvas. In the event you examined your endpoint utilizing a Jupyter pocket book, you&#8217;ll be able to shut down your JupyterLab occasion by selecting <strong>Cease <\/strong>or configuring <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/docs.aws.amazon.com\/sagemaker\/latest\/dg\/studio-updated-idle-shutdown-setup.html\" target=\"_blank\" rel=\"noopener noreferrer\">automated shutdown for JupyterLab<\/a>.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-117203\" style=\"margin: 10px 0px 10px 0px;border: 1px solid #CCCCCC\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2025\/09\/26\/ml-18479-9.jpeg\" alt=\"Stop Jupyter Lab Space\" width=\"1288\" height=\"731\"\/><\/p>\n<p>On this publish, we confirmed how you can deploy a SageMaker Canvas mannequin to a serverless endpoint utilizing SageMaker Serverless Inference. By utilizing this serverless method, you&#8217;ll be able to shortly and effectively serve predictions out of your SageMaker Canvas fashions with no need to handle the underlying infrastructure.<\/p>\n<p>This seamless deployment expertise is only one instance of how AWS providers like SageMaker Canvas and SageMaker Serverless Inference simplify the ML journey, serving to companies of various sizes and technical proficiencies unlock the worth of AI and ML. As you proceed exploring the SageMaker ecosystem, remember to try how one can <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/aws.amazon.com\/blogs\/machine-learning\/unlock-the-power-of-data-governance-and-no-code-machine-learning-with-amazon-sagemaker-canvas-and-amazon-datazone\/\" target=\"_blank\" rel=\"noopener noreferrer\">unlock knowledge governance for no-code ML with Amazon DataZone<\/a>, and <a rel=\"nofollow\" target=\"_blank\" href=\"https:\/\/aws.amazon.com\/blogs\/machine-learning\/seamlessly-transition-between-no-code-and-code-first-machine-learning-with-amazon-sagemaker-canvas-and-amazon-sagemaker-studio\/\" target=\"_blank\" rel=\"noopener noreferrer\">seamlessly transition between no-code and code-first mannequin growth<\/a> utilizing SageMaker Canvas and SageMaker Studio.<\/p>\n<hr\/>\n<h3>In regards to the authors<\/h3>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-117212 size-full alignleft\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2025\/09\/26\/nadhya-blog-pic.png\" alt=\"\" width=\"100\" height=\"124\"\/> <strong>Nadhya Polanco\u00a0<\/strong>is a Options Architect at AWS based mostly in Brussels, Belgium. On this function, she helps organizations seeking to incorporate AI and Machine Studying into their workloads. In her free time, Nadhya enjoys indulging in her ardour for espresso and touring.<\/p>\n<p style=\"clear: both\"><strong><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-36600 alignleft\" src=\"https:\/\/d2908q01vomqb2.cloudfront.net\/f1f836cb4ea6efb2a0b1b99f41ad8b103eff4b59\/2022\/05\/17\/brajends.png\" alt=\"\" width=\"100\" height=\"133\"\/> Brajendra Singh<\/strong>\u00a0is a Principal Options Architect at Amazon Internet Companies, the place he companions with enterprise clients to design and implement modern options. With a powerful background in software program growth, he brings deep experience in Knowledge Analytics, Machine Studying, and Generative AI.<\/p>\n<p>       \n      <\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>Deploying machine studying (ML) fashions into manufacturing can usually be a fancy and resource-intensive process, particularly for purchasers with out deep ML and DevOps experience. Amazon SageMaker Canvas simplifies mannequin constructing by providing a no-code interface, so you&#8217;ll be able to create extremely correct ML fashions utilizing your current knowledge sources and with out writing [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":7937,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[387,3564,309,266,388,3147],"class_list":["post-7935","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-machine-learning","tag-amazon","tag-canvas","tag-deployment","tag-models","tag-sagemaker","tag-serverless"],"_links":{"self":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/7935","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7935"}],"version-history":[{"count":1,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/7935\/revisions"}],"predecessor-version":[{"id":7936,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/posts\/7935\/revisions\/7936"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=\/wp\/v2\/media\/7937"}],"wp:attachment":[{"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7935"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7935"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techtrendfeed.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7935"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}<!-- This website is optimized by Airlift. Learn more: https://airlift.net. Template:. Learn more: https://airlift.net. Template: 69d9690a190636c2e0989534. Config Timestamp: 2026-04-10 21:18:02 UTC, Cached Timestamp: 2026-06-13 15:20:51 UTC -->