r/OpenaiCodex • • 29d ago

How do I give Codex Cloud spaces access to certain roles in AWS Accounts? For instance, ViewOnly or Admin role in Dev accounts?

Usually on my personal machine I SSO into the AWS Organizations Console and the aws cli saves the profile. This is so I can have my agent run aws cli commands.

But the issue I have with the Codex Cloud is it can't run aws cli because I can't SSO it (I think). I assume people aren't actually creating long-lived IAM creds since that sounds like a security risk so whats the correct approach?

1 Upvotes

3 comments sorted by

1

u/bezcurhq 28d ago

You're right not to want long-lived IAM keys in there. Current Codex Cloud has OIDC for this: in the environment go to Advanced > OIDC, add an AWS connection, and it shows you an Issuer, Audience and Subject. In each dev account, create an IAM OIDC identity provider plus a role whose trust policy matches those, and attach whatever permissions you want (ViewOnly in one account, admin in another). Tasks then get short-lived credentials, and the AWS CLI and boto3 are listed as supported, including renewal.

Two gotchas: your own SSO permissions don't carry over, only the role's do, and you have to allow the AWS endpoints in the environment's network settings separately. Test one allowed and one denied call before trusting it.

https://learn.chatgpt.com/docs/environments/cloud-environments