hf-cloud-aws-context-discovery
它能做什么
这个技能会在 AI 进行任何云端工作之前,确认它应该使用哪个 AWS 账户、配置文件和区域。适合正在 Amazon Web Services 上设置机器学习部署的人。
适用场景
- ✓当你开始任何 AWS 任务,例如部署到 SageMaker 或调用 AWS API 时。
- ✓当你还没有说明要使用哪个 AWS 配置文件或区域时。
- ✓当你说出类似“使用我的 AWS 账户”这样的话,而智能体需要正确的账户信息的时候。
技能链接
https://github.com/huggingface/skills/blob/main/skills/hf-cloud-aws-context-discovery/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请使用我的 AWS 账户设置一个 SageMaker 部署,并告诉我你找到的配置文件和区域。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会读取你本地的 AWS 设置,例如当前配置文件和区域,并运行一次简单的身份检查。它不会猜测区域,只有在你的设置没有提供区域时才会询问你。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
AWS Context Discovery
Before doing any AWS work, read the user's local AWS config. Don't guess the region, and don't ask the user for things their config already answers.
What to discover
Run these at the start of the AWS work and remember the results for the rest of the session.
1. Active profile
AWS_PROFILE env var, else default. If the user mentioned a profile in their prompt, that overrides. If the named profile doesn't exist in ~/.aws/config, surface that clearly.
2. Region
Resolution order — stop at the first one that produces a value:
- Region the user explicitly named in this conversation
AWS_REGIONenv varAWS_DEFAULT_REGIONenv varregionfield on the active profile in~/.aws/config- Ask the user — but only after the first four have failed
Do not fall back to us-east-1 or any other hardcoded default.
3. Credentials, account ID, caller ARN
aws sts get-caller-identity --profile <profile> --region <region>
Three purposes in one call: confirms credentials are valid (stop if not), returns the Account ID (needed for ARN construction), returns the Arn of the caller.
4. Identify SSO / assumed-role principals
The Arn field tells you what kind of principal this is. The pattern matters because it determines what IAM operations the caller can do.
| ARN pattern | Type | IAM write capability |
|---|---|---|
arn:aws:iam::<acct>:user/<name> |
IAM user | Depends on attached policies |
arn:aws:sts::<acct>:assumed-role/AWSReservedSSO_<...>/<email> |
SSO assumed-role | Typically none — can't create/modify IAM roles |
arn:aws:sts::<acct>:assumed-role/<role>/<session> |
Regular assumed-role | Depends on the role |
If the caller is SSO, surface this immediately before later skills hit iam:CreateRole and fail:
Heads up: you're authenticated via SSO (
AWSReservedSSO_<PermissionSet>_...). SSO principals usually can't create IAM roles directly. If we need a SageMaker execution role, I'll look for an existing one first — if none exists, you'll need to ask whoever manages your AWS access to create one.
This is the highest-leverage thing this skill does. Surfacing it now turns a confusing mid-deployment error into a five-second conversation.
Commands to run
# Effective profile and region (faster than parsing config files)
aws configure list
# Validate credentials and get identity
aws sts get-caller-identity
aws sts get-caller-identity --profile <profile-name> # if a profile was named
aws configure list handles env-var overrides and shows the resolved effective values. Prefer it over parsing ~/.aws/config yourself. If you need to read raw config (e.g. to list profiles), ~/.aws/config and ~/.aws/credentials are plain INI files — read-only.
What to report back
One or two lines, not a wall of text:
Working with profile
my-profileineu-west-1, account123456789012. You're authenticated via SSO, so we'll need to use an existing IAM role rather than create one.
Don't ask the user to confirm the region you just read from their config — they configured it; that is the confirmation.
If something is wrong (credentials expired, profile doesn't exist, no region anywhere), stop and surface the specific error before continuing.
常见问题
它会退回到默认区域吗?
不会。它使用你的设置或你指定的区域,不会假设一个写死的默认值。
如果我的配置文件不存在怎么办?
该技能会明确报告,方便你在工作开始之前修正配置文件。
它会检查我是否已登录吗?
会。身份检查会在工作继续之前确认你的凭证有效。
详情
作者的原始描述
Discover the user's local AWS context (active profile, region, account ID, caller identity) at the start of any AWS task. Use this skill before any other AWS work — deploying to SageMaker, creating resources, calling AWS APIs, or anything that touches an AWS account. Use it especially when the user has not specified a region or profile explicitly, when they say things like "use my AWS account", "deploy to AWS", "use my profile", or when about to make any AWS CLI or SDK call. Never guess the region or account ID — always use this skill to read it from the local configuration first.
repo: huggingface/skills
热度
- GitHub 星标
- 11k
- 排名
- #11766
- 许可证
- Apache-2.0
- 更新时间
- 2026/10/30
评论
- …
同一仓库的更多技能
hf-cli
11k帮你的智能体使用 Hugging Face 命令行工具,下载、上传和管理模型、数据集、Spaces、仓库以及本地缓存。
hf-cloud-python-env-setup
11k帮你的智能体设置一个干净的 Python 环境,使用合适的 Python 版本和最新的库,然后再运行 SageMaker 或 AWS 自动化脚本。
hf-cloud-sagemaker-deployment-planner
11k帮你的智能体规划如何把模型部署到 Amazon SageMaker,在实时、无服务器、异步或批量托管之间进行选择,并使用合理的默认设置。
hf-cloud-sagemaker-iam-preflight
11k帮你的智能体在部署前确认可用的 SageMaker 执行角色,避免未经检查就在你的 AWS 账户中创建新权限。