aws-ai
Installation
SKILL.md
aws-ai
Use this skill to execute AWS operations through this repo's aws-ai CLI wrapper (local script or Docker image), keeping MFA/session flow predictable for agent-driven work.
When to use
- User asks to run AWS CLI commands via this project helper.
- User wants the agent to operate AWS without installing AWS CLI locally.
- Session/MFA handling is needed (assume-role + temporary credentials).
Instructions
NOTE To use this skill, the user must clone the repository https://github.com/KaribuLab/aws-cli-helper.git, then build the image with the following command:
docker build -t aws-ai
-
Validate prerequisites before first command:
- Confirm
.envexists (or required env vars are present):AWS_AI_PROFILE,AWS_AI_ASSUME_ROLE_ARN,AWS_AI_MFA_SERIAL_ARN,AWS_REGION. - Prefer Docker flow when user requested no local dependencies:
docker run --rm -it -v ~/.aws:/home/user/.aws --env-file ~/.aws-ai/.env aws_ia <aws args>
- Confirm
-
Prime credentials on first use by asking the user to run this exact command themselves:
docker run --rm -it -v ~/.aws:/home/user/.aws --env-file ~/.aws-ai/.env aws_ia sts get-caller-identity- Reason: this captures MFA once and stores temporary session credentials for later agent commands.
-
After priming, run requested AWS operations through the helper (not raw
aws):- Docker:
docker run --rm -i -v ~/.aws:/home/user/.aws --env-file ~/.aws-ai/.env aws_ia <service> <operation> [flags]
- Docker:
-
MFA refresh rule for agents (15-minute STS sessions):
- Track the time when priming succeeded.
- At 13 minutes (2 minutes before expiration), pause and ask the user to rerun:
docker run --rm -it -v ~/.aws:/home/user/.aws --env-file ~/.aws-ai/.env aws_ia sts get-caller-identity - Resume automation only after that command succeeds.
-
Error-handling policy:
- If helper output indicates MFA/session failure (
MultiFactorAuthentication failed, expired session token, invalid session, or similar without naming a denied API action likeservice:Action), request re-priming withsts get-caller-identityand retry the original command once. Do not confuse these with IAM permission errors. - Missing IAM permissions: If AWS returns
AccessDenied,UnauthorizedOperation,not authorized to perform, oris not authorized to performand the message names one or more API actions (e.g.ec2:DescribeInstances,iam:GetRole,s3:GetObject), treat it as insufficient policy on the assumed role. Tell the user exactly whichAction(s) to allow in the IAM policy (inline or managed) attached to that role. When the error includes a resource ARN, reference it in a minimalStatementexample (Action+Resource/Conditionas appropriate). If the message does not list the action, infer it from the CLI subcommand (e.g.aws ec2 describe-instances→ec2:DescribeInstances) and state any uncertainty. - If credentials persistence fails, continue with current command result but warn that next commands may require MFA again.
- If helper output indicates MFA/session failure (
-
Safety and output behavior:
- Do not expose MFA codes, session tokens, or secret values in responses.
- Summarize command outcomes clearly for the user instead of dumping raw logs unless explicitly requested.