Getting started¶
Subscribe, create the model in your account, run one real-time call and one batch job, and delete the resources the test created.
You need: a subscription to this product, and a SageMaker notebook
instance or Studio space whose role can create endpoints and batch transform
jobs and can read and write the SageMaker default bucket. The public
notebook says AmazonSageMakerFullAccess is enough for that sample.
1. Subscribe¶
Open the listing, choose View purchase options, review the terms, and subscribe.
2. Create the model¶
Use the sample notebook or the same calls yourself. The notebook maps each Region it supports to a model package ARN. Create the model with network isolation and that ARN:
sm.create_model(
ModelName="<name>",
ExecutionRoleArn=role,
EnableNetworkIsolation=True,
PrimaryContainer={"ModelPackageName": model_package_arn},
)
The key is not an environment variable. A Marketplace model package does not take environment variables. Send the key with each request, as Usage describes. Choose a secret and keep it the same across runs when you want stable placeholders. The notebook tells you to replace the sample value before you send real text.
3. Real-time endpoint¶
The notebook creates an endpoint configuration and an endpoint on
ml.m5.large with one instance, then waits until the endpoint is in
service. It says creation takes about 5 to 8 minutes.
sm.create_endpoint_config(
EndpointConfigName="<name>",
ProductionVariants=[{
"VariantName": "main",
"ModelName": "<name>",
"InstanceType": "ml.m5.large",
"InitialInstanceCount": 1,
}],
)
sm.create_endpoint(EndpointName="<name>", EndpointConfigName="<name>")
sm.get_waiter("endpoint_in_service").wait(EndpointName="<name>")
Send one JSON object with text and your key. The
listing usage
shows this shape:
aws sagemaker-runtime invoke-endpoint \
--endpoint-name <your-endpoint> \
--content-type application/json \
--cli-binary-format raw-in-base64-out \
--body '{"text": "Cliente Maria Souza, CPF 123.456.789-09, tel (11) 98765-4321.", "key": "<your secret>"}' \
out.json
The names in the listing example are illustrative. Keep each real-time request to about 50 short texts or 20,000 characters. SageMaker allows a real-time request 60 seconds.
You pay for the endpoint while it runs. Delete it before you leave the test:
4. Batch transform¶
Put a JSON Lines, CSV, or plain-text file in S3. The notebook writes three
sample files and starts three jobs on ml.m5.large. The listing recommends
ml.c7i.xlarge for batch workloads. Use SplitType Line, and set
Accept to the plain content type. CSV fields that contain line breaks
inside quotes need SplitType None.
The notebook's jobs use content types application/jsonlines,
text/csv; key=<your secret>; csv_columns=2, and
text/plain; key=<your secret>. It says the three sample jobs take about
5 to 7 minutes. A JSON Lines record can carry its own key and options.
A content-type parameter covers lines that do not.
5. Clean up¶
Delete the model after the jobs finish, and delete the sample objects:
The notebook then deletes every object under its S3 prefix. If you stop the notebook early, delete the endpoint, endpoint configuration, model, and sample objects yourself. A batch job that is still running has to finish or be stopped before its model can be deleted.
Last updated November 11, 2026 · Suggest an improvement