AWS Provider
Deep dive into scanning AWS resources with Cloud Cost Analyzer.
Supported Services
CCA analyzes the following AWS services:
| Service | Resource Types | Optimization Rules |
|---|---|---|
| EC2 | Instances, Reserved Instances | Rightsizing, idle detection, RI coverage |
| EBS | Volumes, Snapshots | Unattached volumes, old snapshots, GP2 to GP3 |
| RDS | Instances, Aurora clusters | Rightsizing, idle, RI coverage, storage |
| S3 | Buckets | Lifecycle policies, storage class optimization |
| Lambda | Functions | Memory optimization, unused functions |
| ELB | ALB, NLB, Classic | Idle load balancers, cross-AZ traffic |
| ElastiCache | Clusters | Node sizing, RI coverage |
| NAT Gateway | Gateways | Idle gateways, excessive data transfer |
| ECS/EKS | Clusters, Services | Rightsizing, Fargate Spot opportunities |
Authentication
CCA uses the standard AWS credential chain:
- Environment variables (
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY) - Shared credentials file (
~/.aws/credentials) - IAM role (EC2, ECS, Lambda)
- AWS SSO / IAM Identity Center
Environment Variables
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
export AWS_REGION=us-east-1
cca scan --provider aws
Named Profiles
CCA uses the standard AWS credential chain. Select a named profile with --profile, which works the same in Bash, PowerShell and Command Prompt:
cca scan --provider aws --profile production
--profile wins over AWS_ACCESS_KEY_ID left in your environment. The AWS_PROFILE environment variable still works as before (and, as in the AWS CLI, environment keys win over it):
AWS_PROFILE=production cca scan --provider aws
To make sure you scan the account you mean to, add --account. The scan stops, before collecting anything, if the credentials are for a different account:
cca scan --provider aws --profile production --account 123456789012
cca whoami --profile production shows the account a profile resolves to.
IAM Role (EC2/ECS/Lambda)
No configuration needed. CCA automatically retrieves credentials from the instance metadata service.
AWS SSO
This release of cca cannot read SSO profiles itself (--profile and AWS_PROFILE both fail for them). Sign in with the AWS CLI and pass the temporary keys to cca:
aws sso login --profile my-sso-profile
# Bash or zsh
eval "$(aws configure export-credentials --profile my-sso-profile --format env)"
# PowerShell
aws configure export-credentials --profile my-sso-profile --format powershell | Invoke-Expression
cca scan --provider aws
Assume Role
# Assume a role first
aws sts assume-role \
--role-arn arn:aws:iam::123456789012:role/CostAnalyzerRole \
--role-session-name cca-scan
# Or use a profile with role_arn configured
# ~/.aws/config
[profile cross-account]
role_arn = arn:aws:iam::123456789012:role/CostAnalyzerRole
source_profile = default
cca scan --provider aws --profile cross-account
Provisioning access
cca setup --provider aws provisions the read-only access a scan needs. Who runs
it depends on your environment.
Self-service (you have cloud-admin rights)
cca setup --provider aws --output-template # preview the exact read-only policy (changes nothing)
cca setup --provider aws --deploy # create the role + policy via CloudFormation
--deploy requires permission to deploy CloudFormation and create IAM resources
(iam:CreateRole, iam:CreatePolicy, iam:AttachRolePolicy, and the
CAPABILITY_NAMED_IAM acknowledgement). It uses your current AWS session, so
authenticate first (corporate accounts are usually SSO), and select the profile
via AWS_PROFILE (there is no --profile flag):
aws sso login --profile my-profile
AWS_PROFILE=my-profile cca setup --provider aws --deploy
--deploy always targets --region (default us-east-1), which overrides the
profile's region; pass --region to place the stack elsewhere. Re-running is
safe: CloudFormation applies only the diff (idempotent).
Restricted (you cannot create IAM roles)
Most enterprises lock this down. Do not fight --deploy; hand off the policy
instead:
cca setup --provider aws --output-template -f cca-role.yaml
Give cca-role.yaml to your cloud/platform team (a ticket, or a PR into their
Terraform/CloudFormation repo). They deploy it once; you then consume the result:
- read-only credentials, or
- an assumable role ARN (add it to
~/.aws/config, see Assume Role), or - OIDC federation for CI, with no long-lived secrets (see the GitHub Actions guide).
For many accounts at once, provision the role across the org with CloudFormation StackSets (see Multi-Account Scanning).
Required IAM Permissions
CCA requires read-only access to analyze resources. Here's a minimal IAM policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "CCAReadAccess",
"Effect": "Allow",
"Action": [
"ec2:Describe*",
"rds:Describe*",
"rds:ListTagsForResource",
"s3:GetBucketLocation",
"s3:GetBucketTagging",
"s3:GetLifecycleConfiguration",
"s3:GetBucketVersioning",
"s3:ListAllMyBuckets",
"elasticloadbalancing:Describe*",
"lambda:List*",
"lambda:GetFunction",
"lambda:GetFunctionConfiguration",
"elasticache:Describe*",
"ecs:Describe*",
"ecs:List*",
"eks:Describe*",
"eks:List*",
"cloudwatch:GetMetricStatistics",
"cloudwatch:ListMetrics",
"ce:GetCostAndUsage",
"ce:GetReservationUtilization",
"ce:GetSavingsPlansCoverage",
"pricing:GetProducts",
"organizations:DescribeOrganization",
"tag:GetResources"
],
"Resource": "*"
}
]
}