$npx -y skills add aws/agent-toolkit-for-aws --skill signing-in-to-awsGets 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", "co
| 1 | # Sign In — Get CLI/SDK Credentials |
| 2 | |
| 3 | 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. |
| 4 | |
| 5 | **Important:** |
| 6 | |
| 7 | - You MUST run `aws login` and `aws --version` in the user's local shell — NOT via MCP/API tools. |
| 8 | - 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 run `aws login`?" or "Shall I proceed with `aws login`?"). Wait for their response before proceeding. |
| 9 | |
| 10 | ## Prerequisites |
| 11 | |
| 12 | The `aws login` command requires **AWS CLI version 2.32.0 or later**. |
| 13 | |
| 14 | Check the installed version: |
| 15 | |
| 16 | ```bash |
| 17 | aws --version |
| 18 | ``` |
| 19 | |
| 20 | 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](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)), 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. |
| 21 | |
| 22 | ## Flow |
| 23 | |
| 24 | ### Lead with the recommendation |
| 25 | |
| 26 | 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. |
| 27 | |
| 28 | ### Precondition checks (run silently before asking confirmation) |
| 29 | |
| 30 | Run these via the local shell to inform your plan. Report what you find, but do not gate the recommendation on user-supplied output: |
| 31 | |
| 32 | 1. `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](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) and stop. |
| 33 | 2. `aws sts get-caller-identity` — check current credentials. |
| 34 | - **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. |
| 35 | - **Fails** (missing or expired): proceed with `aws login` on the default profile. |
| 36 | 3. *(Only if Step 2 succeeded and the user wants different credentials)* `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. |
| 37 | |
| 38 | ### Confirm and run aws login |
| 39 | |
| 40 | 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>`). |
| 41 | |
| 42 | ### Verify |
| 43 | |
| 44 | 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`. |
| 45 | |
| 46 | ## Handling Errors |
| 47 | |
| 48 | ### "command not found" or version too old |
| 49 | |
| 50 | The CLI is not installed or below 2.32.0. Direct the user to install or update: [AWS CLI installation guide](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html). |
| 51 | |
| 52 | ### Browser doesn't open |
| 53 | |
| 54 | Suggest `aws login --remote` which provides a URL and code for cross-device authentication (e.g., when using a remote server without a browser). |
| 55 | |
| 56 | ### Permission error after login |
| 57 | |
| 58 | 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. |
| 59 | |
| 60 | ### GovCloud or China regions |
| 61 | |
| 62 | `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. |
| 63 | |
| 64 | ## Users With Existing `aws sso login` Workflows |
| 65 | |
| 66 | If the user mentions `aws sso login` or has an existing SSO configuration, do NOT redir |