Connect AWS
Let kosem assume one or more IAM roles of yours, with no key, so that access profiles can issue short-lived AWS credentials.
Connect an AWS account through an IAM role whose trust policy takes kosem's identity tokens for this one connection, so that kosem keeps no key. You can attach up to 20 IAM roles on the same connection. Access profiles then issue short-lived session credentials for one of those roles, lasting up to an hour. To do it, you need Owner or Connection Admin on the kosem organization, or on the project for a project's own connection, and, in AWS, permission to create an IAM OpenID Connect provider and a role.
Create the connection
- In your organization, click Access, then Connections.
- Click Connect an account, and select Amazon Web Services.
- Optionally, enter a Name (optional), and under Share with, select the projects that can use it.
- Click Continue.
kosem creates the connection, which needs attention until AWS trusts it, and opens its page.
To connect an account for one project alone, start in the project instead: click Access, then Connections, then Connect an account, and select Amazon Web Services. The project's own connection isn't shared with other projects. If the page says a policy keeps projects from connecting accounts of their own, your organization turned on Turn off projects' own connections.
Set up the trust in AWS
On the connection's page, under Trust in AWS:
- Under Policy, select what the role can do: ReadOnlyAccess, PowerUserAccess, or None: I'll attach policies myself. The role's permissions are all that credentials can do.
- Copy the commands from the AWS CLI tab, and run them in a terminal signed in to the account, or click Open CloudShell. The Terraform tab has the same as Terraform.
The commands create an IAM OpenID Connect provider of kosem's issuer, unless the account has it, and a role named for the connection, whose trust policy takes this connection's subject alone. They print the role's ARN.
Finish setup
- Enter the Role ARN the commands printed, such as
arn:aws:iam::123456789012:role/kosem-acme. STS region isus-east-1unless you select another. - Click Finish setup.
kosem assumes the role to check the trust. It also checks that AWS refuses other identities, such as another connection's, and refuses a trust policy that takes them. IAM can take a few seconds to apply a new role: if AWS refuses at first, wait and try again.
Once it's connected, create an access profile that issues its credentials, or add additional IAM roles from the connection's Overview.
Stop one agent's sessions
AWS can't revoke one session. Each session that kosem starts carries the source identity of the agent or the person it's for, so a policy in your account that denies aws:SourceIdentity of one agent stops its credentials at once.