AI Agent AWS Access
Local AI agents should use temporary AWS credentials from IAM Identity Center. Do not create an IAM user or long-lived access keys for an agent. The local pattern is:
Human IAM Identity Center login
-> AIAgentReadOnly permission set
-> ai-agent-readonly AWS CLI profile
-> agent launched from that shell
Prerequisites
- Your IAM Identity Center user is a member of the
AI-Agent-Operatorsgroup. - The
AI-Agent-Operatorsgroup is assigned to the target AWS account. - The assigned permission set is
AIAgentReadOnly. - AWS CLI v2 is installed locally.
If AIAgentReadOnly does not appear when configuring the CLI profile, the permission set
has not been assigned to the selected AWS account for your user or group.
Configure the local profile
Create a dedicated AWS CLI profile for the agent:
aws configure sso --profile ai-agent-readonly
Use these values when prompted:
SSO session name (Recommended): autointel
SSO start URL [None]: https://autointel.awsapps.com/start
SSO region [None]: us-east-1
SSO registration scopes [sso:account:access]: sso:account:access
The CLI will attempt to open a browser for IAM Identity Center authentication. If the browser does not open, copy the generated URL from the terminal and open it manually. That authorization URL is generated per login attempt, so do not save it in documentation or scripts.
After authentication, select the platform account and the agent role:
There are 5 AWS accounts available to you.
Using the account ID 999655274916
There are 3 roles available to you.
Using the role name "AIAgentReadOnly"
Default client Region [None]: us-east-1
CLI default output format (json if not specified) [None]: json
Do not select AdministratorAccess or DevUser for an agent profile.
Log in and verify
Authenticate the profile:
aws sso login --profile ai-agent-readonly
Verify that the profile resolves to the expected IAM Identity Center role:
aws sts get-caller-identity --profile ai-agent-readonly
The returned ARN should include AWSReservedSSO_AIAgentReadOnly.
Run low-risk read checks:
aws s3 ls --profile ai-agent-readonly
aws lambda list-functions --profile ai-agent-readonly
aws dynamodb list-tables --profile ai-agent-readonly
Launch an agent with the profile
Before launching a local agent, clear any static AWS credentials and set the profile:
unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
export AWS_PROFILE=ai-agent-readonly
export AWS_REGION=us-east-1
Then start the agent from the same shell:
codex
The agent inherits AWS_PROFILE=ai-agent-readonly and uses the temporary credentials
from IAM Identity Center through the standard AWS credential provider chain.
Safety check
These commands should work:
aws lambda list-functions
aws dynamodb list-tables
aws s3 ls
Privilege-changing commands should fail. For example:
aws iam create-role --role-name should-not-work --assume-role-policy-document '{}'
If a privileged command succeeds, stop using the shell for agent work and check that
AWS_PROFILE is set to ai-agent-readonly and no static AWS credentials are present.