hf-cloud-sagemaker-iam-preflight

Discover, validate, or create a SageMaker IAM execution role before deploying models.

507|40|Updated Apr 26, 2026
One-click install
npx skills add https://github.com/waybarrios/opencode-power-pack --skill hf-cloud-sagemaker-iam-preflight-waybarrios
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: hf-cloud-sagemaker-iam-preflight
Source: https://github.com/waybarrios/opencode-power-pack/tree/main/skills/hf-cloud-sagemaker-iam-preflight
Command: npx skills add https://github.com/waybarrios/opencode-power-pack --skill hf-cloud-sagemaker-iam-preflight-waybarrios

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? SageMaker deployments commonly fail because no usable execution role exists, or because scripts try to create a new role when the caller (often an SSO principal) lacks IAM permissions. This Skill enforces the correct order — discover existing roles, validate their trust policy, and only create a role when nothing usable exists. ## Core Features & Use Cases - Role Discovery and Ranking: Searches the AWS account for SageMaker execution roles, ranks candidates by last-used date (falling back to creation date), and returns the first role whose trust policy allows sagemaker.amazonaws.com. - Role Validation: Validates a user-supplied role name or ARN, confirming it exists and trusts the SageMaker service principal, printing the ARN on success. - Guarded Role Creation: Creates a role with the canonical trust policy, attaches AmazonSageMakerFullAccess, and applies a minimum-permissions inline policy scoped to a specific S3 model bucket, while warning when the caller is an SSO principal likely to hit AccessDenied. - Use Case: Before creating a SageMaker endpoint, run the discovery helper to find an existing execution role ARN instead of failing mid-deployment with IAM errors. ## Quick Start Ask the assistant to find or validate a SageMaker execution role in my AWS account before I create a model or endpoint.

Frequently Asked Questions about hf-cloud-sagemaker-iam-preflight

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find an existing SageMaker execution role in my AWS account?▼

Run python3 scripts/check_role.py with no arguments. It lists roles matching common SageMaker naming patterns, ranks them by last-used date (falling back to creation date), validates each trust policy, and prints the ARN of the first usable role.

How do I validate a specific SageMaker role ARN before deployment?▼

Pass the role name or ARN to check_role.py: python3 scripts/check_role.py "<role-name-or-arn>". It confirms the role exists and that its trust policy allows sagemaker.amazonaws.com to assume it, printing the ARN on success.

Why does creating a SageMaker role fail with AccessDenied for SSO users?▼

SSO principals typically lack iam:CreateRole, iam:AttachRolePolicy, and iam:PutRolePolicy, so role creation fails with AccessDenied. The fix is to ask an AWS admin for an execution role ARN or have them grant those permissions to your SSO permission set.

Does the SageMaker role checker work on Windows?▼

Yes, the helpers are Python and run on Windows, macOS, and Linux. On Windows run them directly in PowerShell with python, not through WSL or Git Bash, since those Bash environments often do not share the Windows AWS credentials, SSO session, or proxy settings.

What permissions does a SageMaker execution role actually need?▼

The minimum set covers s3:GetObject and s3:ListBucket on the model artifact bucket, ECR pull permissions for serving images, and CloudWatch logs and metrics actions. These are defined in references/minimum-permissions.json and layered on top of AmazonSageMakerFullAccess.

When should I create a new SageMaker role instead of reusing one?▼

Only create a role after discovery confirms no existing candidate passes trust-policy validation. Most accounts that have used SageMaker before already have a usable role, and creating duplicates adds maintenance overhead.