AWS sagemaker documentation change
Summary
Removed all SageMaker Python SDK v2 (Legacy) code examples and references throughout the documentation, leaving only SDK v3 examples. Updated text references to remove mentions of V2.
Security assessment
The changes solely remove outdated SDK v2 examples and update text to reflect SDK v3 usage. There's no evidence of security vulnerability fixes, security feature additions, or security-related content. The modifications appear to be routine documentation cleanup.
Diff
diff --git a/sagemaker/latest/dg/define-pipeline.md b/sagemaker/latest/dg/define-pipeline.md index b7eba9ebf..1a482326c 100644 --- a//sagemaker/latest/dg/define-pipeline.md +++ b//sagemaker/latest/dg/define-pipeline.md @@ -167,3 +166,0 @@ Create a new SageMaker AI session using the following code block. This returns t -SageMaker Python SDK v3 - - @@ -185,18 +181,0 @@ SageMaker Python SDK v3 -SageMaker Python SDK v2 (Legacy) - - - - import boto3 - import sagemaker - import sagemaker.session - from sagemaker.workflow.pipeline_context import PipelineSession - - region = boto3.Session().region_name - sagemaker_session = sagemaker.session.Session() - role = sagemaker.get_execution_role() - default_bucket = sagemaker_session.default_bucket() - - pipeline_session = PipelineSession() - - model_package_group_name = f"AbaloneModelPackageGroupName" - @@ -286,3 +264,0 @@ The number of rings in the abalone shell is a good approximation for its age usi -SageMaker Python SDK v3 - - @@ -300,14 +275,0 @@ SageMaker Python SDK v3 -SageMaker Python SDK v2 (Legacy) - - - - from sagemaker.workflow.parameters import ( - ParameterInteger, - ParameterString, - ) - - processing_instance_count = ParameterInteger(name="ProcessingInstanceCount", default_value=1) - model_approval_status = ParameterString(name="ModelApprovalStatus", default_value="PendingManualApproval") - input_data = ParameterString(name="InputData", default_value=input_data_uri) - batch_data = ParameterString(name="BatchData", default_value=batch_data_uri) - @@ -322,3 +283,0 @@ This section shows how to create a processing step to prepare the data from the -SageMaker Python SDK v3 - - @@ -346,16 +304,0 @@ SageMaker Python SDK v3 -SageMaker Python SDK v2 (Legacy) - - - from sagemaker.sklearn.processing import SKLearnProcessor - - framework_version = "0.23-1" - - sklearn_processor = SKLearnProcessor( - framework_version=framework_version, - instance_type="ml.m5.xlarge", - instance_count=processing_instance_count, - base_job_name="sklearn-abalone-process", - sagemaker_session=pipeline_session, - role=role, - ) - @@ -364,3 +306,0 @@ SageMaker Python SDK v2 (Legacy) -SageMaker Python SDK v3 - - @@ -384,20 +323,0 @@ SageMaker Python SDK v3 -SageMaker Python SDK v2 (Legacy) - - - from sagemaker.processing import ProcessingInput, ProcessingOutput - from sagemaker.workflow.steps import ProcessingStep - - processor_args = sklearn_processor.run( - inputs=[ - ProcessingInput(source=input_data, destination="/opt/ml/processing/input"), - ], - outputs=[ - ProcessingOutput(output_name="train", source="/opt/ml/processing/train"), - ProcessingOutput(output_name="validation", source="/opt/ml/processing/validation"), - ProcessingOutput(output_name="test", source="/opt/ml/processing/test") - ], - code="abalone/preprocessing.py", - ) - - step_process = ProcessingStep(name="AbaloneProcess", step_args=processor_args) - @@ -419,3 +338,0 @@ This section shows how to use the SageMaker AI XGBoost Algorithm to train a mode -SageMaker Python SDK v3 - - @@ -451,31 +367,0 @@ SageMaker Python SDK v3 -SageMaker Python SDK v2 (Legacy) - - - from sagemaker.estimator import Estimator - - image_uri = sagemaker.image_uris.retrieve( - framework="xgboost", - region=region, - version="1.0-1", - py_version="py3", - instance_type="ml.m5.xlarge" - ) - xgb_train = Estimator( - image_uri=image_uri, - instance_type="ml.m5.xlarge", - instance_count=1, - output_path=model_path, - sagemaker_session=pipeline_session, - role=role, - ) - xgb_train.set_hyperparameters( - objective="reg:linear", - num_round=50, - max_depth=5, - eta=0.2, - gamma=4, - min_child_weight=6, - subsample=0.7, - silent=0 - ) - @@ -484,3 +369,0 @@ SageMaker Python SDK v2 (Legacy) -SageMaker Python SDK v3 - - @@ -511,25 +393,0 @@ SageMaker Python SDK v3 -SageMaker Python SDK v2 (Legacy) - - - from sagemaker.inputs import TrainingInput - from sagemaker.workflow.steps import TrainingStep - - train_args = xgb_train.fit( - inputs={ - "train": TrainingInput( - s3_data=step_process.properties.ProcessingOutputConfig.Outputs[ - "train" - ].S3Output.S3Uri, - content_type="text/csv" - ), - "validation": TrainingInput( - s3_data=step_process.properties.ProcessingOutputConfig.Outputs[ - "validation" - ].S3Output.S3Uri, - content_type="text/csv" - ) - }, - ) - - step_train = TrainingStep(name="AbaloneTrain", step_args=train_args) - @@ -545,4 +403 @@ This section shows how to create a processing step to evaluate the accuracy of t - 1. Create an instance of a `Processor` (V3) or `ScriptProcessor` (V2) for evaluation. - -SageMaker Python SDK v3 - + 1. Create an instance of a `Processor` for evaluation. @@ -562,15 +416,0 @@ SageMaker Python SDK v3 -SageMaker Python SDK v2 (Legacy) - - - from sagemaker.processing import ScriptProcessor - - script_eval = ScriptProcessor( - image_uri=image_uri, - command=["python3"], - instance_type="ml.m5.xlarge", - instance_count=1, - base_job_name="script-abalone-eval", - sagemaker_session=pipeline_session, - role=role, - ) - @@ -579,3 +418,0 @@ SageMaker Python SDK v2 (Legacy) -SageMaker Python SDK v3 - - @@ -615,36 +451,0 @@ SageMaker Python SDK v3 -SageMaker Python SDK v2 (Legacy) - - - from sagemaker.workflow.properties import PropertyFile - - evaluation_report = PropertyFile( - name="EvaluationReport", - output_name="evaluation", - path="evaluation.json" - ) - - eval_args = script_eval.run( - inputs=[ - ProcessingInput( - source=step_train.properties.ModelArtifacts.S3ModelArtifacts,