The Simplest Way to Make AWS Redshift and AWS Sagemaker Work Like They Should
Teams pair aws redshift and aws sagemaker to train models on warehouse data. Redshift stores the structured tables, and SageMaker runs the notebooks and training jobs. This setup lets data scientists pull clean features straight from the data warehouse. Once a model finishes running, it writes predictions back into warehouse tables. Analytics teams can then read those scores in their daily reports. How aws redshift and aws sagemaker share roles and data The two services talk to each other th
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Teams pair aws redshift and aws sagemaker to train models on warehouse data. Redshift stores the structured tables, and SageMaker runs the notebooks and training jobs.
This setup lets data scientists pull clean features straight from the data warehouse. Once a model finishes running, it writes predictions back into warehouse tables. Analytics teams can then read those scores in their daily reports.
How aws redshift and aws sagemaker share roles and data
The two services talk to each other through IAM roles and storage buckets. First, an admin sets up an IAM role for the notebook or job. That role needs permission to read from the warehouse and use temporary storage.
For small queries, a notebook can run a direct query through the data API. The data API handles the request without holding open a persistent database session. It checks the IAM role and returns rows to the notebook.
For large training sets, direct queries are too slow for the cluster. Instead, Redshift exports the query results as files into an S3 bucket. SageMaker then reads those files from the bucket to train the model.
When the model creates new predictions, the flow runs in reverse. The training job writes output files back to the shared bucket. Redshift then loads those files into a target table for analysts to query.
You can also call a live model endpoint right from a warehouse query. A database user runs a function that sends row values to the model. The model scores the row and sends the result back to the table.
Common failure modes and how to scope roles
Many teams start by sharing one broad IAM role across every notebook. This shortcut creates major security gaps as the data team grows. If every user shares one role, database logs show the same caller identity.
Shared database logins cause the exact same problem inside the warehouse. Engineers often put a single admin password into shared notebook files. Anyone who opens that notebook can read or drop tables across the cluster.
AWS IAM Policies + Redshift Security: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Long-lived database keys also leak into code repos and job logs. If a key leaks, an attacker can pull bulk customer tables fast. Sensitive fields like emails, phone numbers, card numbers, and national IDs face high risk.
Data masking helps reduce risk by rewriting matched fields in query results. Even with masking, you still need strict role scoping between both services. Give each notebook profile its own narrow IAM role and database group.
Grant that group read permission on specific feature views, not raw source tables. Limit bucket permissions so a job can only read its own folder path. Separate training roles from production roles so test jobs cannot overwrite live tables.
Setting up safe network paths between the services
By default, cloud services may talk over public endpoints if left unchecked. You should place both the warehouse cluster and the notebooks inside private subnets. This keeps all training data off the public internet during transfer.
Use private VPC endpoints for the storage bucket and the data API. Traffic then stays inside your private network when moving files or running queries. Set security group rules to allow traffic only between known subnet groups.
Finally, turn on audit logs for both the warehouse and your cloud roles. Check these logs often to see which notebook ran each warehouse query. Good logs help you spot slow queries and block unused roles early.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
Should I use the data API or S3 to move training data?
Use the data API for small lookups and quick feature checks in notebooks. Use S3 unload and load commands when moving large datasets for model training.
How do I stop notebooks from reading sensitive customer columns?
Create restricted database views that leave out sensitive columns or apply data masking. Grant the notebook role permission to read only those safe views.
Why do all notebook queries show the same user in warehouse logs?
This happens when multiple data scientists share one notebook instance or database user. Assign unique IAM roles and database users to each person to fix the logs.
Related guides
In this post