website/docs/endpoint-devices/authentik-agent/device-authentication/cli-app-authentication/aws.mdx
You can use the authentik Agent to authenticate to the AWS CLI with authentik credentials.
To support the integration of authentik Agent with AWS CLI, you need to create an application/provider pair in authentik.
Log in to authentik as an administrator and open the authentik Admin interface.
Navigate to Applications > Applications and click Create with Provider to create an application and provider pair. (Alternatively you can first create a provider separately, then create the application and connect it with the provider.)
authentik-aws-cli), an optional group for the type of application, the policy engine mode, and optional UI settings.Public.authentik-aws-cli.authentik-cli provider as a Federated OIDC Provider.Click Submit to save the new application and provider.
To support the integration of AWS with the authentik Agent, you need to configure authentik CLI as an IDP and setup permission roles in AWS.
OpenID Connecthttps://authentik.company/application/o/<application-slug>/authentik-aws-cli<account_id> with your AWS Account ID:{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "arn:aws:iam::<account_id>:oidc-provider/authentik.company/application/o/authentik-aws-cli/"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"authentik.company/application/o/authentik-aws-cli/:aud": "authentik-aws-cli"
}
}
}
]
}
On the device running AWS CLI, update the ~/.aws/credentials file with the following, replacing <role_arn> with the ARN of the role above:
[default]
credential_process = ak auth aws --client-id authentik-aws-cli --role-arn <role_arn>
To verify, run aws sts get-caller-identity, which should output something like this
{
"UserId": "xxxxxx",
"Account": "<account_id>",
"Arn": "arn:aws:sts::<account_id>:assumed-role/<role name>/<authentik username>"
}