AWS Training
Modules Listen Certification

← SageMaker Use Case Discovery — Meeting Prep

Starts this lesson and continues through 21 more to the end of the course.

Predictive ML on warehouse data — Redshift ML, Canvas, and SageMaker AI

The shortest path from a labelled table to a number on a dashboard

Candidate 1 — enrollment and withdrawal prediction — has what most first ML projects lack: a binary label already in a Redshift fact table. So Thursday's question is not "can AWS do this" but "which route, and what does each leave running overnight". The routes: train and predict inside Redshift (Redshift ML), train with no code (SageMaker Canvas), train with code (Autopilot or a built-in algorithm) — and, under all of them, where inference runs. The dashboard is scored nightly. That fact decides the architecture.

Route 1: Amazon Redshift ML — the model is a SQL function

What CREATE MODEL does

From the Redshift ML overview (verified 2026-11-16): "Amazon Redshift works with Amazon SageMaker AI Autopilot to automatically obtain the best model and make the prediction function available in Amazon Redshift." Redshift "exports the training data into Amazon S3"; Autopilot preprocesses it and picks the algorithm and hyperparameters; Redshift "registers the prediction function as a SQL function".

The simple form, copied from CREATE MODEL use cases (verified 2026-11-16):

CREATE MODEL model_name
FROM { table_name | ( select_query ) }
TARGET column_name
FUNCTION prediction_function_name
IAM_ROLE { default }
SETTINGS (
  S3_BUCKET 'amzn-s3-demo-bucket',
  [ MAX_CELLS integer ]
)

The guided form adds MODEL_TYPE { XGBOOST | MLP | LINEAR_LEARNER }, PROBLEM_TYPE ( REGRESSION | BINARY_CLASSIFICATION | MULTICLASS_CLASSIFICATION ), OBJECTIVE ( 'MSE' | 'Accuracy' | 'F1' | 'F1Macro' | 'AUC' ) and, in SETTINGS, KMS_KEY_ID, S3_GARBAGE_COLLECT { ON | OFF } and MAX_RUNTIME. The full syntax warns: "follow the order of the keywords". AUTO ON is the default.

⚠️ That page spells one objective 'F1_Macro' in the syntax block and 'F1Macro' in the parameter list. The docs contradict themselves.

From the usage notes (verified 2026-11-16):

The prediction function, and writing predictions back

For classification, Redshift "automatically creates a second inference function" named with the suffix _probabilities, returning a SUPER value of labels and probabilities (getting started, verified 2026-11-16). The same page shows the write-back as plain CREATE TABLE AS (the docs' sample churn dataset, abbreviated — not ours):

CREATE TABLE churn_auto_predict_probabilities AS
 (SELECT customer_churn_predict_probabilities(Account_length, Area_code, ...) AS prediction
  FROM customer_activity);

SELECT prediction.labels[0], prediction.probabilities[0]
FROM churn_auto_predict_probabilities
WHERE prediction.probabilities[0] > 0.7;

A probability per application is what the per-term, per-center, per-program roll-up needs. Access is SQL grants: GRANT CREATE MODEL and GRANT EXECUTE ON MODEL.

IAM, S3 and network

The same page: a role with AmazonS3FullAccess and AmazonSageMakerFullAccess, trusted by redshift.amazonaws.com and sagemaker.amazonaws.com. It also prints a "more restrictive policy" — start from that one. With enhanced VPC routing you need "an Amazon S3 VPC endpoint and an SageMaker AI VPC endpoint". Redshift deletes the training export and artifacts after training (S3_GARBAGE_COLLECT defaults to ON). Role and key design is DE4.6.

Cost controls and limits

From Costs for using Amazon Redshift ML (verified 2026-11-16): "There is no additional charge for prediction functions that run within your Amazon Redshift cluster." Training is billed by SageMaker AI and "increases with the number of cells" — rows times columns.

Setting Default Effect
MAX_CELLS 1,000,000 Above it, CREATE MODEL randomly down-samples the training rows
MAX_RUNTIME 5,400 s (90 min) Caps SageMaker AI training time; the statement itself can run longer

The pricing page (verified 2026-11-16) shows $20 per million cells for the first 10M, $15 for the next 90M, $7 beyond, and states "Redshift ML is also available for use with Amazon Redshift Serverless".

⚠️ One million cells at 50 columns is 20,000 training rows. The default is a cost guard, not a sensible sample — set MAX_CELLS deliberately.

⚠️ Set MAX_RUNTIME too low and you get "Autopilot candidate has no models". Evidence for a support case: SHOW MODEL model_name (status, failure reason, validation error, estimated cost, the SageMaker AI job name) and SELECT schema_name, model_name, model_state FROM stv_ml_model_info;.

⚠️ MODEL_TYPE FORECAST calls Amazon Forecast, and the Forecast guide says it "is no longer available to new customers". I could not verify whether a new account can use MODEL_TYPE FORECAST — relevant to candidate 2; ask.

Redshift dialect traps: SQL0.5.

Route 2: SageMaker Canvas — no code, but a meter running

The docs still call it "Amazon SageMaker Canvas". It sits in the SageMaker AI console's left navigation and in SageMaker Studio, and needs a SageMaker AI domain (getting started, verified 2026-11-16). It also absorbed the Autopilot UI: "As of November 30, 2023, Autopilot's UI is migrating to Amazon SageMaker Canvas" (Autopilot).

Model types (Canvas): numeric prediction, 2 and 3+ category prediction, time series forecasting, image and text prediction. Candidate 1 is "2 category prediction".

Redshift connection (data import, verified 2026-11-16): "Amazon Redshift provisioned clusters (not Amazon Redshift Serverless)". The execution role needs AmazonRedshiftFullAccess, Redshift as a trusted principal, and association with the cluster (permissions).

Build limits (how custom models work):

Numeric and categorical
Quick build 2–20 min; sampled to 50,000 rows; 2-category minimum 500 rows
Standard build 2–4 hours; minimum 250 rows
Large datasets down-sampled to 5 GB (stratified)
Maximum columns 1,000

Cost dimensions (billing, pricing, verified 2026-11-16):

Dimension What the page says
Workspace instance (Canvas:Session-Hrs) $1.9/hour from launch until log out
Space storage a 100 GB EBS gp3 volume, charged "including while the Canvas application is stopped", until the user profile is deleted
Training SageMaker training instance hours; page estimate $2.3–$9.2 under 100 MB
Batch prediction, tabular up to 5 GB runs in the app "free of additional charges"; larger uses EMR Serverless plus batch transform

Stopping charges (logging out): "you are billed for as long as the instance runs. Logging out … stops the workspace instance billing." Builds "continue running even if you log out". Idle shutdown is something you build: a Lambda function calling DeleteApp.

⚠️ Closing the browser tab is not logging out. Use the Log out button or delete the app.

⚠️ Canvas is not a nightly scorer. Automatic batch predictions work only "for datasets imported through local upload or Amazon S3" and "can only run while you're logged in" (batch predictions). Canvas is for the first model, not for production scoring.

Route 3: Autopilot and built-in algorithms, at map level

Autopilot is the AutoML engine behind both routes above: it identifies the problem type, explores algorithms, tunes hyperparameters and ranks candidates (Autopilot, verified 2026-11-16). The UI lives in Canvas; coders use the AutoML API. For tabular binary classification the built-in algorithm table lists eight options including Linear Learner, LightGBM, CatBoost and XGBoost — "gradient boosted trees" for "regression, classification (binary and multiclass), and ranking" (XGBoost). Take this route only when Redshift ML's limits actually block you.

Inference options — and why a nightly dashboard needs none of the endpoints

From Inference options (verified 2026-11-16):

Option Payload Processing time Idle behaviour Fits
Real-time endpoint 25 MB 60 s (8 min streaming) "persistent" endpoint on your instance type interactive, low latency
Serverless 4 MB 60 s "not for idle time"; cold starts intermittent traffic
Asynchronous 1 GB one hour can "scale down your endpoint to 0" large queued requests
Batch transform datasets "GBs in size" "days" no persistent endpoint offline scoring of a file
Redshift ML function n/a — a SQL call query time none; no extra charge scoring rows already in Redshift

Serverless memory is 1,024–6,144 MB and excludes GPUs, VPC configuration and Model Monitor (serverless). Async reads its payload from S3 (async). Batch transform writes its output to S3, caps MaxPayloadInMB at 100 MB per mini-batch, and "doesn't support CSV-formatted input that contains embedded newline characters" (batch transform).

⚠️ Contradictions on fetched pages:

⚠️ Quotas, from the quota table (defaults "based on new accounts"): ml.m5.xlarge for transform job usage is 0, adjustable; ml.m5.large for endpoint usage is 0, adjustable; "Number of instances across all transform jobs" is 4, adjustable. Check yours in Service Quotas.

The memorable idea: for a nightly-scored dashboard the cheapest correct architecture has no endpoint at all. Endpoints answer requests that arrive when you don't control the clock. Nightly scoring controls the clock. A scheduled SQL statement (scheduled queries) that rebuilds a predictions table with the Redshift ML function has no payload limit, no instance quota and nothing to forget to delete. Batch transform is the fallback when the model can't live in Redshift.

Predictions into Quick Sight — the three hypotheses, tested

H1: "SageMaker Canvas can read a Redshift table and build a first model without code." Supported, with two conditions: provisioned clusters only — "not Redshift Serverless" — and the AmazonRedshiftFullAccess role setup above. ⚠️ The custom models table lists sources for 2 category prediction as "Local upload, Amazon S3, SaaS connectors", omitting Redshift, while the data import page includes it.

H2: "Predictions written back to Redshift become one more dataset for Quick Sight." Supported on the Redshift ML route: the docs show CREATE TABLE AS over the prediction function, and Amazon Redshift is a supported Quick Sight source. Canvas documents a different path: it sends batch predictions "as CSV files to Quick" directly, to Author or Admin users in the default namespace, same Region (send predictions). I found no documented Canvas-to-Redshift write-back; that load step would be yours.

H3: "Quick Sight has built-in forecasting and anomaly insights that need no model." Supported. Enterprise edition forecasts and detects anomalies with "a built-in version of the Random Cut Forest (RCF) algorithm" (the ML algorithm, ML insights, verified 2026-11-16). Limits:

Forecast Anomaly detection
Shape one date field, up to three metrics; default 14 periods; seasonality 1–180 at least one date, one measure, one dimension; up to five dimension fields
Minimum history 38 daily points, 43 monthly, 35 quarterly 15 points
Other "not compatible with small multiples" not in eu-central-2; priced per 1,000 metrics evaluated

That covers candidate 2's simple trend and a first look at candidate 3 — not candidate 1: it forecasts an aggregate series, not one application from its attributes.

Can Quick Sight call a SageMaker model directly? Yes, as documented today, and only in batch (SageMaker AI integration, verified 2026-11-16): "you can use only batch transforms … You can't use an SageMaker AI endpoint." It runs during SPICE refresh, supports "up to 500 million rows per dataset", caps jobs at 10 hours, allows one model per dataset, and "Output fields can't be used to calculate new fields" — another reason to score in Redshift. The page carries no deprecation notice. ⚠️ I could not verify from the console that the option is still offered in the dataset UI. SPICE itself is Q2.

Two concepts that decide whether candidate 1 is real

Target leakage. The docs: "Target leakage occurs when there is data in a machine learning training dataset that is strongly correlated with the target label, but is not available in real-world data"; a feature score of 1 "often indicates target leakage" (analyses, verified 2026-11-16). For candidate 1 the rule is: only features known at application time. Anything recorded after that point predicts the outcome because it is the outcome. A suspiciously excellent first model is a leakage finding. FROM ( select_query ) is your control: select the feature columns explicitly, never the whole table.

Split by time. Autopilot's ValidationFraction defaults to 0.2 (AutoMLDataSplitConfig) and it uses k-fold cross-validation for 50,000 or fewer training instances (validation); Canvas's advanced settings offer a split ratio. None of those pages describes splitting by date. The honest test for candidate 1: train on earlier terms, score a later term, compare with what happened. In Redshift ML that is a WHERE on the training query, then the prediction function over the held-out term. The Autopilot API accepts a separate validation channel. ⚠️ I could not verify a date-based split option in Canvas — ask.

Metrics. Canvas reports, for 2-category models: Accuracy, AUC, BalancedAccuracy, F1, LogLoss, Precision, Recall (metrics), plus column impact and confusion matrices (scoring). Redshift ML defaults to F1 for binary classification; its docs explain that when one outcome is rare, a model predicting the common class every time gets "high accuracy but little business value".

What AWS will ask you about this

  1. "Is your Redshift provisioned or Serverless?" Canvas imports only from provisioned clusters; Redshift ML supports both.
  2. "How fresh do predictions need to be?" Nightly means no endpoint.
  3. "How many rows and columns in the training set?" It sets MAX_CELLS cost and tests the 256-column and 500-row limits. Bring a real number.
  4. "Which columns are known at application time?" The leakage question. Have the list.

What to ask AWS

  1. "Can a Canvas- or Autopilot-trained model be imported into Redshift for local inference?" The usage notes say local BYOM supports XGBoost, MLP and Linear Learner models trained by Autopilot; Canvas's ensembling mode uses AutoGluon. I could not verify the combination.
  2. "Is MODEL_TYPE FORECAST usable in our account, given Amazon Forecast is closed to new customers?" Decides the Redshift ML path for candidate 2.
  3. "Which serverless limits are ours — 50 endpoints or 5?" The pages disagree.
  4. "What are our transform-job instance quotas today, and how long do increases take?" The new-account default is 0.
  5. "Does Canvas offer a time-based split, and does 2 category prediction accept a Redshift source?" The docs are silent on the first and inconsistent on the second.

Check yourself

  1. What does CREATE MODEL put in S3, and what happens to it by default?
  2. The default MAX_CELLS with 40 columns trains on how many rows?
  3. Why can't Canvas be the nightly scorer?
  4. A first model for candidate 1 scores AUC 0.99. What do you check first?
Answers
  1. The training data export and model artifacts. S3_GARBAGE_COLLECT defaults to ON, so Redshift deletes them after training.
  2. About 25,000 — one million cells divided by 40 columns, randomly sampled.
  3. Automatic batch predictions only cover datasets imported by local upload or S3, and only run while a user is logged in — which is also when the session-hour meter runs.
  4. Target leakage: a feature recorded after application time. Then check the split was by time.

Teaching this section

← PreviousQualifying an ML use case — what a discovery call is really testingNext →Generative AI — Bedrock, SageMaker AI JumpStart, or Quick Suite