Features
FinOps: real AWS bill
FinOps estimates a cluster's cost from the node price list and live usage. With finops.aws.enabled,
orbit-api also reads the account's real bill from AWS Cost Explorer and the Deck shows it on the
FinOps overview, beside the estimate: month to date, Cost Explorer's own forecast, last month, the top
services and the last 30 days.
The bill is the whole AWS account's, with its account id, not the cluster's, so only a role that
holds settings.manage reads it (GET /api/v1/clusters/{id}/finops/billing); every other role
sees the cluster's estimate without the bill.
Why a role, and why read-only
orbit-api never holds a long-lived AWS key when it does not have to. It reads the bill through the role its pod is given, and that role can only read:
| Action | Why |
|---|---|
ce:GetCostAndUsage | month to date, last month, by service, daily totals |
ce:GetCostForecast | the end-of-month forecast |
ce:GetDimensionValues | the services that appear in the account |
sts:GetCallerIdentity | which account the bill belongs to |
The policy is deploy/aws/finops-readonly-policy.json. It names no account and no resource, so the
same files work in any customer's account.
Before you start
- Cost Explorer is enabled once per payer account (Billing console, Cost Explorer, Launch). Until then every call answers an error and the Deck says the bill is unavailable.
- AWS Organizations: in a member account, Cost Explorer returns that account's own costs. The payer account sees the whole organization. Use the account whose bill you want to show.
- Cost Explorer charges $0.01 per API call. orbit-api caches the bill for 6 hours, so it costs a few cents a day, however many people open the Deck. Past 6 hours the Deck gets the last bill at once while orbit-api reads the next one, and only when someone opens FinOps.
Option A: EKS Pod Identity (recommended)
Pod Identity needs no OIDC provider per cluster and no annotation in the chart. The cluster needs the
eks-pod-identity-agent add-on.
CLUSTER=my-eks NAMESPACE=sreorbit RELEASE=sreorbit deploy/aws/setup-pod-identity.shhelm upgrade sreorbit deploy/helm/sreorbit -n sreorbit --reuse-values --set finops.aws.enabled=trueThe script is idempotent. It creates the role sreorbit-finops-readonly (override with ROLE_NAME)
trusting pods.eks.amazonaws.com (deploy/aws/trust-pod-identity.json), writes the read-only policy
inline, and associates the role with the <release>-orbit-api ServiceAccount. The same by hand:
aws iam create-role --role-name sreorbit-finops-readonly \ --assume-role-policy-document file://deploy/aws/trust-pod-identity.jsonaws iam put-role-policy --role-name sreorbit-finops-readonly --policy-name sreorbit-finops-readonly \ --policy-document file://deploy/aws/finops-readonly-policy.jsonaws eks create-pod-identity-association --cluster-name my-eks --namespace sreorbit \ --service-account sreorbit-orbit-api \ --role-arn arn:aws:iam::<account>:role/sreorbit-finops-readonlyOption B: IRSA
For clusters with an IAM OIDC provider and no Pod Identity agent. Fill deploy/aws/trust-irsa.json
(ACCOUNT_ID, OIDC_PROVIDER without https://, NAMESPACE, SERVICE_ACCOUNT =
<release>-orbit-api), create the role with it and the same read-only policy, then annotate
orbit-api's ServiceAccount only:
helm upgrade sreorbit deploy/helm/sreorbit -n sreorbit --reuse-values \ --set finops.aws.enabled=true \ --set components.orbit-api.serviceAccount.annotations."eks\.amazonaws\.com/role-arn"=arn:aws:iam::<account>:role/sreorbit-finops-readonlycomponents.<name>.serviceAccount.annotations is merged over the chart-wide
serviceAccount.annotations, so the role lands on orbit-api's account and nowhere else.
Option C: static keys (last resort)
Outside EKS, an IAM user with the same policy and its keys in the release Secret, passed to orbit-api
as AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY through components.orbit-api.secretEnv. Rotate
them; prefer A or B wherever a role is possible.
Network policy
With networkPolicy.enabled, finops.aws.enabled opens orbit-api's egress to TCP 443 (Cost Explorer
and STS have no fixed addresses) and to the Pod Identity agent at 169.254.170.23:80, and nothing
else in the link-local range.
Verifying
The FinOps overview shows AWS bill (real) once the first read succeeds. The API says why when it does not:
curl -s -H "Authorization: Bearer $ORBIT_AUTH_TOKEN" -H "X-Orbit-Session: $SESSION" \ http://<orbit-api>:8080/api/v1/clusters/<id>/finops/billingreason | Meaning |
|---|---|
not-configured | finops.aws.enabled is off |
no-credentials | no Pod Identity, IRSA or key reached the pod: check the association or annotation, then restart the pod |
denied | the role exists but the policy is missing, or Cost Explorer is not enabled |
error: ... | anything else, with AWS's message |
Removing it
helm upgrade sreorbit deploy/helm/sreorbit -n sreorbit --reuse-values --set finops.aws.enabled=falseaws eks delete-pod-identity-association --cluster-name my-eks --association-id <id>aws iam delete-role-policy --role-name sreorbit-finops-readonly --policy-name sreorbit-finops-readonlyaws iam delete-role --role-name sreorbit-finops-readonly