Auth
Client
Cortex client uses the default credential provider chain to get credentials. Credentials will be read in the following order of precedence:
environment variables
the name of the profile specified by
AWS_PROFILE
environment variabledefault
profile from~/.aws/credentials
API management
Cortex client relies on AWS IAM to authenticate requests (e.g. cortex deploy
, cortex get
) to a cluster on AWS. The client will include a get-caller-identity request that has been signed with the credentials from the default credential provider chain along with original request. The operator executes the presigned request to verify that credentials are valid and belong to the same account as the IAM entity of the cluster.
AWS credentials required to authenticate cortex client requests to the operator don't require any permissions. However, managing the cluster using cortex cluster *
commands do require permissions.
Cluster management
It is recommended that your AWS credentials have AdministratorAccess before running cortex cluster *
commands.
After spinning up a cluster using cortex cluster up
, the IAM entity user or role that created the cluster is automatically granted system:masters
permission to the cluster's RBAC. Make sure to keep track of which IAM entity originally created the cluster.
Running cortex cluster
commands from different IAM users
cortex cluster
commands from different IAM usersBy default, the cortex cluster *
commands can only be executed by the IAM user who created the cluster. To grant access to additional IAM users, follow these steps:
Install
eksctl
by following these instructions.Determine the ARN of the IAM user that you would like to grant access to. You can get the ARN via the IAM dashboard, or by running
aws iam get-user
on a machine that is authenticated as the IAM user (orAWS_ACCESS_KEY_ID=*** AWS_SECRET_ACCESS_KEY=*** aws iam get-user
on any machine, using the credentials of the IAM user). The ARN should look similar toarn:aws:iam::764403040417:user/my-username
.Set the following environment variables:
Run the following command:
To revoke access in the future, run:
Authorizing your APIs
When spinning up a cortex cluster, you can provide additional policies to authorize your APIs to access AWS resources by creating a policy and adding it to the iam_policy_arns
list.
If you already have a cluster running and would like to add additional permissions, you can update the policy that is created automatically during cortex cluster up
. In IAM console search for cortex-<cluster_name>-<region>
to find the policy that has been attached to your cluster. Adding more permissions to this policy will automatically give more access to all of your Cortex APIs.
NOTE: The policy created during cortex cluster up
will automatically be deleted during cortex cluster down
. It is recommended to create your own policies that can be specified in iam_policy_arns
field in cluster configuration. The precreated policy should only be updated for development and testing purposes.
cortex cluster up
will create a default policy which is the minimum set of IAM permissions to run your APIs and various processes on the cluster such as the operator and fluent-bit. Fields from your AWS account and cluster configuration will be used to populate the policy below.
Last updated