More Info:
Root account has full permissions across the entire account. Root account should not have access keys. Also, it certainly shouldn”t access any service. Instead, create IAM users with predefined roles.Risk Level
HighAddress
SecurityCompliance Standards
PCI, HIPAA, APRA, MAS, NISTTriage and Remediation
- Remediation
Remediation
Using Console
Using Console
To remediate “Access Keys for Root Account” in AWS IAM using the AWS Management Console, you should (1) remove the root access keys and (2) ensure you have a proper IAM admin user instead.
1. Verify you have an alternative admin user
Before deleting root access keys, make sure there is at least one IAM user with administrator permissions.- Sign in to the AWS Management Console as root (since you’re fixing root keys) or as an existing admin.
- Go to IAM → Users.
- If no suitable admin user exists:
- Click Add users.
- Enter a User name (e.g.,
admin-user). - Select Provide user access to the AWS Management Console and set a console password as desired.
- Click Next.
- Under Set permissions, choose:
- Attach policies directly and select AdministratorAccess, or
- Add user to group and choose a group that has admin-equivalent permissions.
- Complete the wizard (Next → Create user).
- Sign out and sign back in as this IAM admin user to confirm you can manage resources.
2. Locate and delete root access keys
You must sign in as the root user to manage root access keys.- Sign out of any IAM user session.
- Sign in as root user:
- On the sign‑in page, choose Root user, enter the root account email, then the password.
- In the console, open your Account settings:
- Choose your account name / AWS account ID (top-right) → Account
- Or go to My Security Credentials (sometimes under your account dropdown).
- In My Security Credentials, scroll to the Access keys (access key ID and secret access key) section under the Root user heading.
- For each existing root access key:
- If it is Active, select Make inactive (if you want a testing period) or go straight to Delete.
- Confirm deletion when prompted.
- Ensure that no Active or Inactive access keys remain for the root account (preferably 0 keys total).
3. Confirm nothing is using the root keys
Before or immediately after deletion, check whether anything was still using those keys:- While signed in as root or as an admin IAM user, open CloudTrail.
- Search for Event source =
signin.amazonaws.comor operations using the root’s access key ID (if known). - Verify that no critical workloads or automation depended on those keys; if something breaks, reconfigure it to use an IAM user or role instead (never root).
4. Secure the root account (required best practices)
- Still in My Security Credentials, set up MFA:
- Under Multi-factor authentication (MFA), click Assign MFA device.
- Choose Authenticator app or Security key, follow the wizard to complete setup.
- Verify Contact Information, Alternate Contacts, and Security challenge questions are up to date.
5. Use IAM users/roles instead of root
For anything that was using the root access keys:- Create an appropriate IAM user or IAM role with least-privilege permissions.
- Generate access keys for that IAM user (if programmatic access is required):
- IAM → Users → select user → Security credentials → Create access key.
- Update applications / scripts / CI systems to use the new IAM user’s keys or assumed role instead of the root credentials.
Using CLI
Using CLI
For the AWS root account, the correct remediation is to delete all root access keys and stop using them. Root keys should not exist.Below are the AWS CLI steps to find and delete root access keys.
Output example:Collect all
Confirm:Ensure
Verify that no keys remain:At this point, the root account has no access keys.
0. Preconditions
- You must run these commands authenticated as the root user (i.e., using the root user’s access key/secret or via a session started with them).
- Install and configure the CLI:
1. List Existing Root Access Keys
AccessKeyId values.2. (Optional) First Inactivate the Keys
This reduces risk before permanent deletion, especially if they’re still in use somewhere:Status is Inactive.3. Delete All Root Access Keys
Once you’re sure nothing is relying on them:4. Create/Use an Admin IAM Role Instead of Root
From now on:- Create an IAM admin role (one time, via console or CLI) and use that for administration.
- Avoid ever re-creating root access keys.
5. Additional Hardening (Recommended, but not CLI-only)
- Enable MFA for the root account (must be done in the console).
- Ensure root is only used for:
- Account settings / billing
- A few rare account-level tasks
Using Python
Using Python
You cannot delete or rotate root access keys via the AWS API (including Python/boto3).
The API can only detect that root access keys exist; the actual deletion must be done in the console while logged in as the root user.Below is how to handle this in a Python-based workflow:
You can run this as part of CI/CD or a compliance check, and fail if root keys exist.
The API can only detect that root access keys exist; the actual deletion must be done in the console while logged in as the root user.Below is how to handle this in a Python-based workflow:
1. Detect if the root account has access keys (Python/boto3)
2. Remediation steps (manual, but enforceable via Python checks)
-
Sign in as the root user
- Go to https://signin.aws.amazon.com and log in with the root email address (not an IAM user).
- Complete MFA if configured.
-
Delete the root access keys
- In the AWS Management Console, open:
My Security Credentials→Access keys (access key ID and secret access key) - For each access key:
- Deactivate it.
- Then delete it.
- In the AWS Management Console, open:
-
Verify with Python that keys are gone
After you delete them, rerun the Python check:
3. Replace root usage with IAM + roles (Python examples)
3.1 Create an admin IAM role for human admins
From the console (once per account):- IAM → Roles → Create role.
- Trusted entity: AWS account → “This account”.
- Attach policy:
AdministratorAccess(or a restricted custom admin policy). - Name it
OrganizationAdminRole(for example).
3.2 Assume the admin role from Python instead of using root
Use STS to assume the admin role and then perform admin actions:4. Enforce this as a policy
Use the detection script to:- Fail CI/CD pipelines when
root_access_keys_present()isTrue. - Periodically scan accounts (e.g., via a Lambda or external compliance tool).
- Alert via SNS/Slack when root keys are detected.
Using Terraform
Using Terraform
Terraform cannot remediate root account access keys because the AWS root user is not an IAM resource and is not exposed via any Terraform-managed API.To fix this, you must use the AWS console (or direct AWS CLI) as the root user:
- Sign in as the AWS root user.
- Go to “My Security Credentials”.
- Under “Access keys (access key ID and secret access key)”, deactivate and then delete all access keys for the root account.
terraform plan will show no changes related to this remediation.
