The Simplest Way to Make Cloud Storage and Sagemaker Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair cloud storage and sagemaker to train and run machine learning models in production. Cloud buckets hold raw files and model weights, while compute nodes read and write them. This workflow separates cheap file storage from fast, costly GPU compute nodes. Data scientists can spin up notebooks or training jobs when they need them. When the job ends, the results go back to the storage bucket. Then the compute node shuts down to save money. How data and roles flow between cloud storage a

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 cloud storage and sagemaker to train and run machine learning models in production. Cloud buckets hold raw files and model weights, while compute nodes read and write them.

This workflow separates cheap file storage from fast, costly GPU compute nodes. Data scientists can spin up notebooks or training jobs when they need them. When the job ends, the results go back to the storage bucket. Then the compute node shuts down to save money.

How data and roles flow between cloud storage and sagemaker

Every training job or notebook instance needs an execution role to run. This role tells the cloud provider which storage buckets the job can touch. When a job starts, the cloud platform gives the node temporary role keys. The training script uses those keys to pull training files from the bucket.

Data flows in two main ways during a model training run. In file mode, the node downloads the whole dataset to a local disk first. In pipe mode, the node streams data straight from the bucket into memory. Streaming works well for huge datasets because it starts faster and uses less disk space.

Once training finishes, the node bundles the final model weights into an archive file. It writes this archive back to an output path in the storage bucket. Later, hosting endpoints read that exact file to serve live predictions to users.

Common failure modes and how to scope access

The biggest mistake teams make is sharing one broad execution role across all notebooks. If a role can read every bucket, any user can pull sensitive company files. A single shared role also makes storage logs hard to read during an audit. You can see that the role read a file, but not which person ran it.

Static storage keys inside notebook files create another big risk for teams. Engineers sometimes paste long-lived keys into scripts to pull data from outside buckets. If someone pushes that notebook to a shared code repo, those keys leak. Attackers can then read or delete your training data from anywhere.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can fix these risks by scoping roles to specific bucket prefixes and tasks. Give each project or team its own execution role with narrow read and write rules. Separate the role that trains the model from the role that serves live traffic. Training jobs need read access to raw data, while endpoints only need model files.

Locking down network paths and sensitive training data

Good role rules are not enough if network traffic crosses the public internet. By default, compute nodes might talk to storage buckets over public network routes. You should place your notebooks and training jobs inside a private virtual network. Then, set up a private storage endpoint inside that same network.

Next, add a bucket policy that rejects any traffic not coming from that endpoint. This stops stolen keys from working outside your private cloud network. You should also turn on data encryption for every bucket that holds model files. Use managed encryption keys and grant key access only to the specific job roles.

Training datasets often hold raw user fields like emails, phone numbers, or card numbers. Before files reach the training bucket, run a cleanup step to scrub those fields. Masking rewrites matched fields in results so raw emails or national IDs do not stay.

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

Why does my training job fail with an access denied error on the bucket?

Check the execution role attached to the job and the bucket policy. If the bucket uses custom encryption keys, the role also needs permission to use them.

Should I use file mode or streaming mode for cloud storage datasets?

Use file mode for small datasets that fit on the node disk. Use streaming mode for large files so jobs start right away without waiting for downloads.

How do I stop notebook users from copying bucket data to their laptops?

Disable direct internet access on the notebook and turn off local file downloads. Route all traffic through a private network and log every storage read request.

The query runs. The emails stay hidden.