AWS CLI/SDK アクセス用の認証情報を `aws login` コマンドで取得します。 **使用する場面:** - 開発者がローカル開発環境で AWS に接続する必要がある場合 - AWS の操作が認証情報の不足または期限切れで失敗した場合 - AWS アクセスの設定方法について質問された場合 **動作トリガー:** 「AWS をセットアップする」「AWS を設定する」「aws login」「認証情報を取得する」「認証する」「セッションの有効期限が切れた」「トークンの有効期限が切れた」「認証情報がない」「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 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 — 現在の認証情報を確認。
aws login --profile <名前> を推奨してください。aws login を進めてください。aws configure list — access_key が AKIA で始まる場合、長期アクセスキーのリスクを説明してください(有効期限がなく、ディスク上にシークレットとして保存され、漏洩時に無期限のアクセスを許可する)。aws login は 15 分ごとに自動ローテーションされ、自動的に期限切れとなり、手動ローテーションが不要であることを伝えてください。前提条件の確認が完了したら、aws login の実行についてのみユーザーに確認を求めてください。
ユーザー自身にコマンドを実行させるよう指示するのではなく、あなたが実行してよいかを尋ねてください(例:「aws login を実行してよいですか?」「aws login --profile staging を進めてよいですか?」)。
返答を待ってから aws login(または aws login --profile <名前>)を実行してください。
aws login の完了後、aws sts get-caller-identity(名前付きプロファイルを使用した場合は --profile を付加)を実行して成功を確認してください。
名前付きプロファイルを使用した場合は、--profile を指定するか AWS_PROFILE を設定するようユーザーに案内してください。
CLI がインストールされていないか、バージョンが 2.32.0 未満です。 インストールまたはアップデートを行うよう案内してください: AWS CLI インストールガイド
aws login --remote を提案してください。URL とコードによるクロスデバイス認証が提供されます(ブラウザのないリモートサーバー使用時などに有効です)。
IAM アイデンティティ(ユーザー、ロール、またはグループ)に SignInLocalDevelopmentAccess マネージドポリシーをアタッチする必要があります。ルートユーザーはこのポリシーを必要としません。
管理者に追加を依頼するか、IAM 権限を持っている場合は自身でアタッチするよう案内してください。
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 を断った場合、または代替手段を求めた場合aws login が利用不可なため)提示する際は、長期アクセスキーのリスクを説明してください: ディスク上に平文で保存され、自動では期限切れにならず、漏洩時に無期限のアクセスを許可します。
次のような場合に使用:
aws login は適しませんaws login は、ルートユーザー、IAM ユーザー、および IAM を使用したフェデレーションに対応しています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:
aws login and aws --version in the user's local shell — NOT via MCP/API tools.aws login. 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?"). Wait for their response before proceeding.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.
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.
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.
aws login --profile <name> so the existing default isn't overwritten.aws login on the default profile.aws configure list — if access_key starts with AKIA, explain that long-term access keys are less secure (never expire, persist on disk as secrets, grant indefinite access if leaked) and that aws login provides short-term credentials that auto-rotate every 15 minutes, expire automatically, and require no manual rotation.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>).
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.
The CLI is not installed or below 2.32.0. Direct the user to install or update: AWS CLI installation guide.
Suggest aws login --remote which provides a URL and code for cross-device authentication (e.g., when using a remote server without a browser).
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.
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.
aws sso login WorkflowsIf 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 login is for users whose organization has configured AWS IAM Identity Center (SSO). They have profiles in ~/.aws/config pointing at an SSO start URL. Respect their established workflow.aws sso login is failing, help troubleshoot within their context: expired SSO session, revoked authorization, cached token issues (~/.aws/sso/cache/), or Identity Center configuration changes.aws configureDo 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:
aws login or asks for alternativesaws login is 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.
aws loginaws login works with root users, IAM users and federation with IAM原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。