Skip to main content
AWS credentials let Ankra estimate the infrastructure cost of your clusters, sync cloud inventory, provision Amazon EKS, and build self-managed k3s clusters on EC2. There are two access levels, and you choose which one to grant:
  • Read-only - cost estimates, pricing data, and cluster discovery only. Ankra never provisions or modifies AWS resources.
  • Provisioning - everything read-only does, plus creating and managing EKS clusters and self-managed k3s clusters on EC2, in a VPC Ankra creates or one you adopt. One write role (AnkraProvisioning) covers every cluster Ankra can build in your account; the EC2 writes it grants are scoped to resources Ankra tags.
An account that wants self-managed clusters but must not grant eks:* has an EC2-only alternative: the AnkraSelfManagedProvisioning role, which is the provisioning role minus the EKS statements. There are also two ways to connect. The IAM role method (recommended) launches a one-click CloudFormation stack that creates a role Ankra assumes with short-lived credentials, secured by a unique external ID - no long-lived keys to store or rotate. The access keys method stores an access key ID and secret for an IAM user - simpler to set up, but you own key rotation, and the access level is whatever the user’s IAM policy allows. The two methods are separate cards on Integrations & alerts → Credentials → Add credential: the role is AWS role (CloudFormation) under Git, registries and keys, and access keys are Amazon Web Services (AWS) under Cloud providers. The role form names the access level a scope: The credential is validated when you save it: the IAM role method performs a real sts:AssumeRole call against your role, and access keys are checked with a read-only sts:GetCallerIdentity call - so a role that can’t be assumed or a key AWS rejects is refused immediately.

What Ankra Accesses

For cost estimation and inventory, Ankra calls these AWS APIs, all read-only:

Provisioning

Provisioning is one write role for every cluster Ankra can build in your account - Amazon EKS and self-managed k3s clusters on EC2. It is a superset of the read-only level, so a single provisioning credential also powers cost estimates and inventory. Ankra tags everything it creates ankra.cloud/managed=true, and its EC2 writes act on resources with that tag, apart from the VPC and subnets of yours that its resources are created in or attached to (the rows below scoped to any VPC or any subnet). IAM writes are limited to names prefixed ankra-eks- or ankra-k3s-, and the rest is read-only lookups. For a self-managed cluster Ankra either builds the cluster’s own network (VPC, subnets, internet and NAT gateways, route table), tagged as its own, or adopts a VPC you own. In an adopted VPC Ankra adds its own security groups, instances and, in bastion_nat mode, a route table. The one thing of yours it changes is in bastion_nat mode: it moves your node subnets onto its route table, and moves each back to the table it was on when the cluster is torn down. It deletes only what it made. The 33 statements of the policy, by their Sid:
Launched the provisioning stack before the self-managed statements were added? Your role carries only the EKS statements, and a self-managed cluster preflight names the EC2 permission it is missing. Update the stack rather than recreating it: on the stack page choose Update → Replace current template → Amazon S3 URL, paste https://ankra-templates.s3.eu-north-1.amazonaws.com/aws/v1/ankra-provisioning.cfn.yaml, keep every parameter as it is, and update. The role ARN and external ID do not change, so the credential in Ankra needs no edit.
The IAM permissions are deliberately narrow: role management applies only to roles named ankra-eks-* and ankra-k3s-* (the ones Ankra itself creates), and iam:PassRole is conditioned so those roles can only be passed to EKS and EC2. Ankra cannot touch any other IAM role in your account, and in EC2 it can add its own resources to your VPC and subnets, but the only thing of yours it can change is which route table a subnet uses, as described above. The same onboarding is served on the API for scripts: GET /api/v1/credentials/aws/onboarding?scope=provisioning returns the external ID and the quick-create link (scope is cost, provisioning or self_managed), POST /api/v1/credentials/aws/role stores the role with its scope, and POST /api/v1/credentials/aws/keys stores access keys - see the credential API. The CLI wraps the same calls; the steps below show it next to the portal.

Self-managed clusters (EC2-only alternative)

The provisioning role is the normal way to build self-managed clusters. For an account that must not grant eks:*, the AnkraSelfManagedProvisioning role (template, scope self_managed) is the provisioning role minus the EKS statements: no EksLifecycle, IamForEksRoles, IamServiceLinkedRolesRead or IamPassRoleForEks, no Cost Explorer reads (its CatalogRead statement carries the pricing, quota and identity lookups only), and service-linked roles limited to Elastic Load Balancing and Spot. Every EC2, SSM, ELB and ankra-k3s-* IAM statement in the table above is in it unchanged. A credential onboarded at this scope builds self-managed clusters but is refused for EKS; an account that wants both uses the provisioning role, not two credentials. When you save a self_managed role, Ankra assumes it and additionally proves it against EC2 (a dry-run DescribeVpcs) and the Canonical Ubuntu AMI parameters, so a role launched from the wrong template is refused when you save it rather than at the first cluster create. An access-keys credential is accepted for self-managed clusters as long as the user’s policy carries the statements above. With the IAM role method, these are exactly the policies the CloudFormation stack creates - you can review the templates before deploying (read-only, provisioning, self-managed). The role’s trust policy only allows Ankra’s AWS principal to assume it, and only when the request carries your external ID, with sessions capped at one hour - Ankra never stores AWS keys for a role credential. With access keys, you attach equivalent policies to an IAM user yourself - Connect with access keys includes ready-made policy JSON.

Before you start

  • A role in Ankra with credentials.write (the built-in owner and admin roles have it). See Credentials.
  • For the IAM role method: an AWS account where you may create CloudFormation stacks and IAM roles (for example AdministratorAccess, or CloudFormation plus IAM write permissions). The flow takes about five minutes.
  • For the access keys method: permission to create IAM policies, users and access keys.

Connect with an IAM role

The three scopes follow the same steps; only the template differs. Most accounts need Cost reporting or Managed Kubernetes (EKS).
1

Open the AWS role form

Go to Integrations & alerts → Credentials, click Add credential, and under Git, registries and keys choose AWS role (CloudFormation). The Connect an AWS role form opens.If it reads AWS role setup is not configured on this Ankra platform, the platform has no CloudFormation template for that scope. Use access keys instead.
2

Choose the scope

Pick Cost reporting, Managed Kubernetes (EKS) or Self-managed Kubernetes (EC2). The line under it says what the scope allows. Ankra prepares a unique external ID (it starts with ankra-) for this scope and puts it into the stack you are about to launch; the form does not show it.
Stay on this page until you finish. Changing the scope or opening the form again prepares a new external ID, which will not match a stack launched before it. See External ID mismatch if this happens.
3

Launch the CloudFormation stack

Click Open CloudFormation. The AWS console’s quick-create page opens in a new tab with the template, the stack name (AnkraCloudCostReadOnly, AnkraProvisioning or AnkraSelfManagedProvisioning), your external ID and the Ankra principal that will assume the role filled in.
  1. If prompted, sign in to the AWS account you want to connect. For self-managed clusters, use the account that owns the VPC you want to build in.
  2. Leave the ExternalId and AnkraPrincipalArn parameters unchanged. You can rename the stack or role if your organisation requires it. The provisioning templates also take an optional PermissionsBoundaryArn if new roles need a permissions boundary.
  3. Tick I acknowledge that AWS CloudFormation might create IAM resources with custom names at the bottom of the page.
  4. Click Create stack.
4

Wait for CREATE_COMPLETE

The stack creates a single IAM role and nothing else, and usually finishes in under a minute. Wait until the stack status shows CREATE_COMPLETE (use the refresh button on the stack page).
5

Copy the Role ARN from the Outputs tab

On the stack page, open the Outputs tab and copy the value of the RoleArn output. It looks like:
If you don’t see an Outputs tab, the stack hasn’t finished creating yet, or you are looking at a different stack.
6

Connect the role in Ankra

Back on the Ankra tab, enter a Name and paste the ARN into Role ARN. The form shows the region the credential uses (Region: followed by the region); it is not a field. Click Connect AWS role.Ankra assumes the role before it saves anything. For Self-managed Kubernetes (EC2) it also runs the EC2 and Canonical Ubuntu AMI probes. On success the credential’s page opens; click Check now on Overview and you see The provider accepted this credential just now. If it fails, the form reads The connection was not completed - see Troubleshooting.
7

Create your first cluster

Follow Amazon EKS or AWS Clusters (self-managed) to provision a cluster from the portal, CLI, or API. If a provisioning stack was launched before the self-managed statements were added, update it first - see the note under Provisioning.
Already added a Cost reporting credential and want to provision clusters? The scope of an IAM-role credential is fixed when it is created. Connect a new credential at the Managed Kubernetes (EKS) scope under a new name, then delete the old credential in Ankra and its CloudFormation stack in AWS. A provisioning credential whose stack predates the self-managed statements is different: keep the credential and update the stack, as described under Provisioning.

Connect with access keys

What an access-keys credential can do is determined entirely by the IAM user’s policy - attach the read-only policy for cost and inventory, or the provisioning policy to also create clusters.
1

Create a least-privilege IAM policy

In AWS IAM, create a policy with exactly the permissions Ankra uses - these mirror the CloudFormation templates of the IAM-role method.For cost and inventory only:
Read-only policy
To also provision clusters - EKS and self-managed - attach the PolicyDocument from the provisioning template instead (a superset of the read-only policy; its 33 statements are listed under Provisioning). It is a long policy because every EC2 write is tag-scoped; do not simplify it to ec2:*.For self-managed clusters without any EKS access, attach the PolicyDocument from the self-managed template instead - see the EC2-only alternative.
2

Create an IAM user and access key

  1. In AWS IAM, create a user (or pick an existing one) and attach the policy from the previous step.
  2. Open the user → Security credentials → Create access key, and choose a use case such as Third-party service.
  3. Copy the access key ID and secret access key - the secret is shown only once.
3

Add the keys to Ankra

Go to Integrations & alerts → Credentials, click Add credential, and under Cloud providers choose Amazon Web Services (AWS). Enter a Name, the Access key ID and the Secret access key.Click Test the connection. Ankra checks the keys with a read-only sts:GetCallerIdentity call, and you see The connection works. Click Add credential; the credential’s page opens.
Use the IAM role method where you can - it avoids storing long-lived secrets, and access is revocable on the AWS side by deleting the CloudFormation stack. With access keys, you own rotation: rotate the key in IAM and replace it in Ankra.

Replace keys or the role

Open the credential and use Settings & access → Replace the secret, as described in Replace the secret. An access-keys credential replaces its Access key ID and Secret access key; an IAM-role credential replaces its Role ARN and External ID. Ankra checks the new values with AWS before it stores them.

Revoking Access

For an IAM-role credential, delete the CloudFormation stack in AWS - this deletes the role, and no further access is possible. For an access-keys credential, deactivate or delete the access key in IAM. Then delete the credential in Ankra.
Revoking on the AWS side while the credential is still in use breaks cost sync and, at the provisioning scopes, Ankra’s ability to manage your EKS or self-managed clusters - a self-managed cluster’s instances keep running, but Ankra can no longer scale, upgrade, stop or tear them down. Delete or replace the Ankra credential first if clusters depend on it.

Troubleshooting AWS Credentials

When saving fails, the portal shows one message for every cause: Could not validate the AWS credentials. Check the access key id and secret access key. - for a role too. The specific answer appears where Ankra tests without saving: Test the connection on the access-keys form, or Check now on a saved credential.

External ID mismatch

External ID mismatch is the most common cause of a denied role assumption: the external ID is prepared each time the form opens or the scope changes, so a stack launched from an earlier visit carries an old ID. Either delete the stack and launch it again from the form you are on, or store the role from the CLI with the ID the stack already has: copy ExternalId from the stack’s Parameters tab and pass it to ankra credentials aws create-role --external-id. AWS reports a nonexistent role as the same access-denied error, so double-check the ARN too.

Saved, but clusters or cost data fail

The connection check only verifies that the role can be assumed (or that the keys are valid) - it does not inspect the attached permissions. If the credential saves fine but cost data stays empty, inventory doesn’t appear, EKS cluster creation fails with AccessDenied, or the self-managed create preflight reports a missing permission, the role or user is missing actions from the tables in What Ankra Accesses. For a stack-created role that usually means the template was modified, or the provisioning stack was launched before the self-managed statements were added - update the stack to the published template. For an access-keys user, re-check the policy against the JSON in Connect with access keys.