SkillsReviewed · huggingface

Hugging Face SageMaker IAM Preflight

SageMaker IAM Preflight is an assistant skill for developers preparing AWS SageMaker deployments, but finding a role does not mean it has the permissions the deployment needs. It supplies instructions, Python helpers and JSON policies for checking existing execution roles before creating one.

Researched 16 Nov 2026

In short.

SageMaker IAM Preflight is an assistant skill for developers preparing AWS SageMaker deployments, but its role checker cannot confirm that a deployment has the permissions it needs. Its main benefit is an ordered process for reusing an existing execution role before creating another. The checker searches trust-policy text without evaluating the policy rules or execution permissions. The creation helper writes IAM resources and can leave an unfinished role if a later step fails. Nothing was executed; platform compatibility, deployment success and operating costs are not established.

Researched and written by an AI model and checked by a second AI model. How it works

The supplied material covers all five files in skills/hf-cloud-sagemaker-iam-preflight: SKILL.md, scripts/check_role.py, scripts/create_role.py, references/minimum-permissions.json and references/trust-policy.json, plus the ancestor repository LICENSE. It preserves the original source location and pinned revision. Other repository skills, including the referenced hf-cloud-aws-context-discovery, and external AWS documentation are outside the supplied scope. No commands were executed. Live permissions, effective trust, deployment outcomes, cross-platform compatibility and operating costs remain unverified.

The overview

Identity

The resource is the hf-cloud-sagemaker-iam-preflight folder in Hugging Face's huggingface/skills repository. It contains SKILL.md, two Python scripts and two JSON policy templates. The original source location is [https://github.com/huggingface/skills/tree/main/skills/hf-cloud-sagemaker-iam-preflight].

Its purpose is to prepare a SageMaker execution role: the AWS role SageMaker assumes to access resources such as model files, container images and logs. That role is separate from the AWS identity invoking the helper scripts.

Assessment

The skill is useful when a developer or coding assistant needs an orderly way to find an existing execution role before requesting IAM changes. It documents supplied-role validation, automatic discovery, role creation and an administrator handoff when creation permissions are unavailable.

Treat its successful role check as a candidate-selection result. The implementation does not establish effective trust or deployment authorization, so the selected role still needs a complete policy review. No execution evidence establishes reliability or a reduction in deployment failures.

Users

The intended users are developers, machine-learning engineers and coding-assistant users preparing SageMaker endpoints, models or training jobs. AWS administrators can also use its templates when supplying execution roles to teams.

Beginners get concrete commands and an explanation of role reuse. They may still need administrator help to interpret trust policies, distinguish their own permissions from the execution role's permissions, and scope access to the intended deployment.

Capabilities

check_role.py accepts a role name or a supported role ARN. Without an argument, it finds roles matching SageMaker execution-role naming patterns, ranks candidates by recorded last use and then creation date, and prints the first ARN whose trust-policy text contains the SageMaker service name.

create_role.py creates a role using the supplied trust template and attaches an inline policy named SageMakerDeploymentMinimum. The policy includes model-bucket read access, ECR image-pull actions, CloudWatch logging and metric submission. It does not attach AmazonSageMakerFullAccess.

The supplied permissions template targets endpoint execution. Training outputs and optional features such as asynchronous output or data capture require separate permission assessment.

Using it

Requirements

The helpers require Python 3, an AWS CLI executable on PATH and working AWS credentials in the invoking shell. They import only Python standard-library modules. Script messages recommend AWS CLI v2, but an exact minimum Python version and a tested compatibility matrix are not supplied.

Discovery calls STS GetCallerIdentity, IAM ListRoles and IAM GetRole. The supplied-role path avoids ListRoles. Creation additionally calls IAM CreateRole and PutRolePolicy. The scripts do not verify all permissions needed by a subsequent deployment, including the caller's ability to pass the role to SageMaker.

The documentation recommends using the shell where AWS CLI authentication already works. On Windows it specifically recommends native PowerShell or Command Prompt when that is where the AWS session is configured; compatibility across these environments was not tested.

Mechanism

The checker first calls STS to confirm that the current CLI identity is accessible. Discovery lists role names, filters them with four naming patterns, retrieves each candidate and sorts descending by last-used timestamp, creation timestamp and name. Missing last-use timestamps rank behind recorded timestamps.

Its trust check serializes the policy to JSON and searches for sagemaker.amazonaws.com. A successful path prints an ARN to standard output and logs progress to standard error. Exit 1 can represent missing candidates, unreadable roles, failed listing or rejected trust text; exit 2 covers a missing CLI or failed identity check.

The creator checks whether the requested role name can be retrieved, reads the caller identity, creates the role, substitutes the supplied bucket into the permission template, attaches the inline policy and retrieves the ARN. It does not invoke account-wide discovery itself.

Setup

Obtain the complete skill folder and preserve its scripts and references subdirectories. create_role.py locates both JSON templates relative to its own file. The captured folder is pinned at [https://github.com/huggingface/skills/tree/25910b3d0ba31a2ba102f901cdc9e008c278a69c/skills/hf-cloud-sagemaker-iam-preflight]. Agent-specific installation steps are not supplied.

The documented sequence is to check an explicitly supplied role first, otherwise discover existing roles, and consider creation only after establishing that no suitable role is available and that the caller is authorized. A failed discovery command alone cannot establish absence because permission failures also produce unsuccessful results.

Before deployment, the instructions call for inspecting the chosen role's policies against the actual S3, ECR, logging and optional output requirements. A real model-bucket name must replace the template placeholder.

Example

An illustrative supplied-role command, from the skill folder, is python3 scripts/check_role.py SageMakerExecutionRoleExample. For discovery, omit the role argument. The source describes successful output as the selected ARN on standard output; no output was observed here.

For authorized creation after the discovery and permission review, the documented form is python3 scripts/create_role.py ExampleSageMakerExecutionRole your-model-bucket. Both names are illustrative and must be replaced with appropriate values. On Windows, the documentation uses python in the configured native shell. None of these commands was executed.

Assessment & evidence

Limitations

The trust checker does not evaluate Effect, Action, principal placement or Conditions. A matching service-name string can therefore pass without establishing that SageMaker can actually assume the role. Execution-role permissions are not inspected at all.

Discovery misses roles with names outside its patterns. For supplied commercial-partition ARNs, the checker keeps only the final role name and queries the current account; it does not verify that the supplied ARN's account matches. Other AWS partition ARN prefixes are not normalized by that branch.

The creator treats any failed initial GetRole call as grounds to continue, although failure can mean insufficient read access. Its SSO check only issues a warning and continues. It does not enforce prior discovery or roll back a created role if policy attachment fails. Omitting the bucket still allows a policy containing the placeholder to be attached.

The policy is a baseline, not proof of least privilege for a particular deployment. ECR actions and metric submission use wildcard resources, and the trust template has no Conditions. Their suitability requires deployment-specific review.

Reasoning

The strongest practical benefit is making role reuse the first step and giving users a concrete administrator handoff when IAM changes are unavailable. Ranking by recent use can help order candidates, but recent use does not establish ownership, suitability or correct permissions.

The documentation's definition of a usable role is broader than the checker's implementation: it includes appropriate permissions, while the checker only retrieves the role and searches its trust text. That gap supports using the skill as preparation with additional IAM review. The source's broad claims about deployment failures are not backed by measurements in the supplied material.

Alternatives

The documented fallback is to use native AWS CLI calls in the authenticated shell: IAM ListRoles for candidates and IAM GetRole for trust policies and usage dates, followed by policy review. This can help when the Python helper cannot access the working AWS environment.

An administrator-provided execution-role ARN is another documented route when listing or creating roles is unavailable. The supplied material does not compare separate products or establish performance advantages over other ways of managing IAM roles.

Evidence

The evidence consists of the full skill instructions, both Python helpers, both JSON policy templates and the repository-level Apache license at one source revision. The implementation findings follow from reading those supplied files; no script, AWS command or deployment was executed.

The original instruction file is available at [https://raw.githubusercontent.com/huggingface/skills/25910b3d0ba31a2ba102f901cdc9e008c278a69c/skills/hf-cloud-sagemaker-iam-preflight/SKILL.md]. The linked source folder provides the accompanying helpers and templates. No runtime logs, platform tests, live account policies or deployment results are supplied.

Access & freshness

Costs

The Apache 2.0 notice grants no-charge, royalty-free copyright permissions under its terms. The supplied material provides no operating-cost estimate or AWS pricing. Costs for a subsequent SageMaker deployment, related AWS resources and any assistant provider remain unknown; no usage or billing evidence is supplied.

Rights

The supplied repository-level LICENSE is Apache License 2.0. It permits copying, modification and redistribution subject to its conditions. Redistribution requires a license copy, retention of applicable notices, notices identifying modified files and preservation of applicable NOTICE attributions if such a file accompanies the work.

The license does not grant general trademark rights and includes warranty and liability disclaimers. It does not establish terms for AWS services or any models and data used in a later deployment. The original license is available at [https://raw.githubusercontent.com/huggingface/skills/25910b3d0ba31a2ba102f901cdc9e008c278a69c/LICENSE].

Freshness

The supplied source snapshot is pinned to commit 25910b3d0ba31a2ba102f901cdc9e008c278a69c and was captured on 2026-11-16 at 02:08:25.683 UTC. That capture time does not establish when the files last changed.

No release version is supplied. Changes after this commit and compatibility with current AWS behavior are unknown. The repository's main-branch URL may contain different content.

Actions

Use the complete pinned folder, confirm the intended AWS account and inspect any returned ARN against that account. Prefer a suitable existing role. Review the full trust statement and conditions, execution permissions and caller authorization before relying on the result.

For creation, establish that the caller has permission, supply the actual model bucket and review the template's resource scope. If creation fails after the role is made, inspect the resulting role before retrying. Verify the actual deployment separately; this material does not establish that any deployment will succeed.

Evidence for this report

LICENSEnotice · checked 2026-11-16