🔐signing-in-to-aws
- プラグイン
- aws-core
- ソース
- GitHub で見る ↗
説明
`aws login` を使用してCLI/SDKアクセス用のAWS認証情報を取得します。 次のような場合に使用: - 開発者がローカル開発のためにAWSへの認証を必要としているとき - 認証情報の未設定または期限切れによりAWS操作が失敗したとき - AWSアクセスのセットアップについて質問があったとき トリガーワード: "set up AWS"、"configure AWS"、"aws login"、"get credentials"、"authenticate"、"session expired"、"token expired"、"no credentials"、認証情報が未設定の状態での "AccessDeniedException"
原文を表示
Gets AWS credentials for CLI/SDK access via `aws login`. Activates when a developer needs to authenticate to AWS for local development, when an AWS operation fails due to missing or expired credentials, or when someone asks about setting up AWS access. Triggers: "set up AWS", "configure AWS", "aws login", "get credentials", "authenticate", "session expired", "token expired", "no credentials", "AccessDeniedException" with no configured credentials.
ユースケース
- ✓ローカル開発のためにAWSへ認証する
- ✓認証情報の未設定または期限切れを解決する
- ✓AWSアクセスのセットアップについて質問されたとき
本文(日本語訳)
サインイン — CLI/SDK 認証情報の取得
aws login を使って、ローカル開発用の AWS 認証情報を開発者が取得できるよう支援します。
このコマンドは、15 分ごとに自動ローテーションされ、最大 12 時間有効な短期認証情報を提供します。
重要事項:
aws loginおよびaws --versionは、MCP/API ツール経由ではなく、必ずユーザーのローカルシェルで実行してください。aws loginを実行する前に、必ずユーザーの確認を取ってください。ユーザー自身にコマンドを実行させるよう指示するのではなく、あなた(AI)が実行してよいか尋ねてください(例:「aws loginを実行してよいですか?」「aws loginを進めてよいですか?」)。返答を待ってから処理を進めてください。
前提条件
aws login コマンドには AWS CLI バージョン 2.32.0 以降 が必要です。
インストール済みのバージョンを確認するには:
aws --version
CLI がインストールされていない、またはバージョンが 2.32.0 未満の場合は、その旨をユーザーに伝え、インストール/アップデートを希望するか(AWS CLI インストールガイドを案内)、またはこの skill のガイダンスなしで続行するかを確認してください。 アップグレードせずに続行する場合は、この skill を使わずに通常どおりリクエストに応答してください。
フロー
最初に推奨事項を伝える
最初の応答では、aws login が解決策であることを必ず伝えてください。短期の自動ローテーション認証情報が提供されること、および AWS CLI 2.32.0 以降が必要なことを説明します。
「まず CLI バージョンを確認します」で止めず、最初から解決策を明示し、その後に実行前の前提条件チェックについて説明してください。
前提条件チェック(確認を求める前にサイレントで実行)
ローカルシェルを通じて以下を実行し、実行計画の参考にしてください。 結果を報告しますが、ユーザーからの入力結果に依存して推奨を止めることはしないでください。
aws --version— CLI が 2.32.0 以降であることを確認。インストールされていないか古すぎる場合は、AWS CLI インストールガイドを案内して停止してください。aws sts get-caller-identity— 現在の認証情報を確認。- 成功した場合: Account と Arn をユーザーに表示し、この認証情報を維持するか、別の認証情報を設定するかを確認します。別の認証情報に切り替える場合は、既存のデフォルト設定を上書きしないよう
aws login --profile <名前>を推奨してください。 - 失敗した場合(認証情報がない、または期限切れ): デフォルトプロファイルで
aws loginを進めてください。
- 成功した場合: Account と Arn をユーザーに表示し、この認証情報を維持するか、別の認証情報を設定するかを確認します。別の認証情報に切り替える場合は、既存のデフォルト設定を上書きしないよう
- (ステップ 2 が成功し、ユーザーが別の認証情報を希望する場合のみ)
aws configure list—access_keyがAKIAで始まる場合、長期アクセスキーのリスクを説明してください(有効期限がなく、ディスク上にシークレットとして保存され、漏洩時に無期限のアクセスを許可する)。aws loginは 15 分ごとに自動ローテーションされ、自動的に期限切れとなり、手動ローテーションが不要であることを伝えてください。
確認して aws login を実行
前提条件の確認が完了したら、aws login の実行についてのみユーザーに確認を求めてください。
ユーザー自身にコマンドを実行させるよう指示するのではなく、あなたが実行してよいかを尋ねてください(例:「aws login を実行してよいですか?」「aws login --profile staging を進めてよいですか?」)。
返答を待ってから aws login(または aws login --profile <名前>)を実行してください。
確認
aws login の完了後、aws sts get-caller-identity(名前付きプロファイルを使用した場合は --profile を付加)を実行して成功を確認してください。
名前付きプロファイルを使用した場合は、--profile を指定するか AWS_PROFILE を設定するようユーザーに案内してください。
エラー対応
"command not found" またはバージョンが古い
CLI がインストールされていないか、バージョンが 2.32.0 未満です。 インストールまたはアップデートを行うよう案内してください: AWS CLI インストールガイド
ブラウザが開かない
aws login --remote を提案してください。URL とコードによるクロスデバイス認証が提供されます(ブラウザのないリモートサーバー使用時などに有効です)。
ログイン後に権限エラーが発生する
IAM アイデンティティ(ユーザー、ロール、またはグループ)に SignInLocalDevelopmentAccess マネージドポリシーをアタッチする必要があります。ルートユーザーはこのポリシーを必要としません。
管理者に追加を依頼するか、IAM 権限を持っている場合は自身でアタッチするよう案内してください。
GovCloud または中国リージョン
aws login は AWS GovCloud (US) および AWS China リージョンでは利用できません。
この例外はユーザーが該当するパーティションに属していることを明示的に述べた場合にのみ触れてください。積極的には言及しないでください。
既存の aws sso login ワークフローを使用しているユーザー
ユーザーが aws sso login に言及している場合、または既存の SSO 設定がある場合は、aws login へ誘導しないでください。
これらは異なる用途の異なるコマンドです。
aws sso loginは、組織が AWS IAM Identity Center(SSO)を設定済みのユーザー向けです。SSO スタート URL を指定したプロファイルが~/.aws/configに存在します。確立されたワークフローを尊重してください。aws sso loginに問題がある場合は、そのコンテキストでトラブルシューティングを支援してください: SSO セッションの期限切れ、認可の失効、キャッシュトークンの問題(~/.aws/sso/cache/)、または Identity Center の設定変更などが原因として考えられます。
aws configure へのフォールバック
最初の応答で aws configure に触れたり、aws login と並べてオプションとして提示したりしないでください。
以下の場合にのみ代替手段として提示してください。
- ユーザーが明示的に
aws loginを断った場合、または代替手段を求めた場合 - ユーザーが GovCloud または中国リージョンを使用していると述べた場合(
aws loginが利用不可なため)
提示する際は、長期アクセスキーのリスクを説明してください: ディスク上に平文で保存され、自動では期限切れにならず、漏洩時に無期限のアクセスを許可します。
この Skill を使用しない場合
次のような場合に使用:
- ユーザーが CI/CD 認証情報をセットアップしている場合 — IAM ロールまたは OIDC フェデレーションが必要であり、
aws loginは適しません
ポイント
- トラブルシューティングを最初から詰め込まないこと — 最初の応答はシンプルに保ち、エラーが発生した場合にのみ対処してください
aws loginは、ルートユーザー、IAM ユーザー、および IAM を使用したフェデレーションに対応しています
関連リソース
原文(English)を表示
Sign In — Get CLI/SDK Credentials
Help developers get AWS credentials for local development using aws login. This provides short-term, auto-rotating credentials that refresh every 15 minutes and remain valid for up to 12 hours.
Important:
- You MUST run
aws loginandaws --versionin the user's local shell — NOT via MCP/API tools. - You MUST ask the user for confirmation before running
aws login. Do not tell the user to run the command themselves — ask if YOU should run it (e.g., "Ready for me to runaws login?" or "Shall I proceed withaws login?"). Wait for their response before proceeding.
Prerequisites
The aws login command requires AWS CLI version 2.32.0 or later.
Check the installed version:
aws --version
If the CLI is not installed or is below 2.32.0, inform the user and ask if they'd like to install/update (link them to the AWS CLI installation guide), or if they'd prefer to continue without this skill's guidance. If they choose to continue without upgrading, respond to their original request as you normally would without this skill.
Flow
Lead with the recommendation
In your first response, always tell the user that aws login is the fix — explain that it provides short-term, auto-rotating credentials and that it requires AWS CLI 2.32.0 or later. Do not stop at "let me check your CLI version" — name the remediation up front so the user knows where this is going, then describe the precondition checks you'll run before invoking it.
Precondition checks (run silently before asking confirmation)
Run these via the local shell to inform your plan. Report what you find, but do not gate the recommendation on user-supplied output:
aws --version— confirm the CLI is 2.32.0 or later. If not installed or too old, point the user to the AWS CLI installation guide and stop.aws sts get-caller-identity— check current credentials.- Succeeds: Show the user their Account and Arn. Ask whether to keep these or set up different credentials. If they want to switch, recommend
aws login --profile <name>so the existing default isn't overwritten. - Fails (missing or expired): proceed with
aws loginon the default profile.
- Succeeds: Show the user their Account and Arn. Ask whether to keep these or set up different credentials. If they want to switch, recommend
- (Only if Step 2 succeeded and the user wants different credentials)
aws configure list— ifaccess_keystarts withAKIA, explain that long-term access keys are less secure (never expire, persist on disk as secrets, grant indefinite access if leaked) and thataws loginprovides short-term credentials that auto-rotate every 15 minutes, expire automatically, and require no manual rotation.
Confirm and run aws login
Once preconditions are clear, ask the user for confirmation specifically for the aws login invocation — and only there. Do not tell the user to run the command themselves; ask if you should run it (e.g., "Ready for me to run aws login?" or "Shall I proceed with aws login --profile staging?"). Wait for their response, then run aws login (or aws login --profile <name>).
Verify
After aws login completes, run aws sts get-caller-identity (with --profile if used) to confirm success. If a named profile was used, remind the user to pass --profile or set AWS_PROFILE.
Handling Errors
"command not found" or version too old
The CLI is not installed or below 2.32.0. Direct the user to install or update: AWS CLI installation guide.
Browser doesn't open
Suggest aws login --remote which provides a URL and code for cross-device authentication (e.g., when using a remote server without a browser).
Permission error after login
The IAM identity needs the SignInLocalDevelopmentAccess managed policy attached (to the user, role, or group). Root users do not need it. Tell the user to ask their administrator to add it, or attach it themselves if they have IAM permissions.
GovCloud or China regions
aws login is not available in AWS GovCloud (US) or AWS China regions. Do not mention this exception proactively — only relevant if the user explicitly states they are in one of these partitions.
Users With Existing aws sso login Workflows
If the user mentions aws sso login or has an existing SSO configuration, do NOT redirect them to aws login. These are different commands for different situations:
aws sso loginis for users whose organization has configured AWS IAM Identity Center (SSO). They have profiles in~/.aws/configpointing at an SSO start URL. Respect their established workflow.- If their
aws sso loginis failing, help troubleshoot within their context: expired SSO session, revoked authorization, cached token issues (~/.aws/sso/cache/), or Identity Center configuration changes.
Fallback to aws configure
Do NOT mention aws configure in your initial response or include it as a table row alongside aws login. Only offer it as an alternative if:
- The user explicitly declines
aws loginor asks for alternatives - The user states they are in GovCloud or China regions (where
aws loginis unavailable)
When offering it, explain that long-term access keys are less secure: they persist on disk as plaintext, never expire automatically, and grant indefinite access if leaked.
When NOT to Use This Skill
- User is setting up CI/CD credentials — they need IAM roles or OIDC federation, not
aws login
Key Points
- Do not front-load troubleshooting — keep the initial response simple and address errors only if they occur
aws loginworks with root users, IAM users and federation with IAM
Additional Resources
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。