How to Delete AWS Secret Access Keys in IAM |Video upload date:  · Duration: PT45S  · Language: EN

Step by step guide to remove AWS secret access keys from IAM using the console and CLI to secure S3 EC2 and EKS access

Why you should care about secret access keys

Secret access keys are tiny little tickets that let scripts and humans pretend to be your AWS account. Lose one and someone else gets to play with S3 buckets EC2 instances and EKS clusters while you write frantic emails. This guide shows how to find list disable delete and rotate IAM secret access keys using the console and the AWS CLI so you can sleep better at night.

Find the IAM user and list keys

First things first confirm which keys exist for the user in question. Use the AWS Management Console if you enjoy clicking things.

Or run this for a quick audit with the AWS CLI

aws iam list-access-keys --user-name USERNAME

The output shows access key ids and statuses. If you see Active keys that should not be there you now have both confirmation and mild panic.

Delete a key using the AWS Management Console

In the console go to IAM then Users pick the user open the Security credentials tab find the access key and click Delete. The console gives a clear two click path for humans who like visual feedback and confirmation prompts.

Disable or delete a key using the AWS CLI

If you prefer typing commands in the dark use the CLI. It is faster and less emotionally satisfying.

To disable a key first run

aws iam update-access-key --user-name USERNAME --access-key-id ACCESSKEYID --status Inactive

After testing delete the key with

aws iam delete-access-key --user-name USERNAME --access-key-id ACCESSKEYID

Disabling first gives you a chance to confirm nothing breaks before you commit to deletion.

Rotate keys for dependent applications and CI

If a pipeline container or server used the deleted key create a replacement key pair and update the credential wherever it lives. That includes environment variables config files CI secret stores and any terraform state that embeds access keys. Yes people still do that.

  • Create a new access key in the console or with the CLI
  • Update environment variables or credentials files on each host
  • Restart services or redeploy pipelines so they pick up the new key

Example CLI commands to verify basic access after rotation

aws s3 ls
aws ec2 describe-instances
aws eks list-clusters

For EKS you may also run the command to refresh kubeconfig and then test kubectl commands.

Verify removal and clean up local machines

Search for stale credentials on developer machines build servers and CI runners. Check the CLI config and credential files located in the default profile or custom profiles under the usual paths. Remove old entries and try a simple AWS API call to confirm the new credentials are in effect.

Common places to check

  • ~/.aws/credentials and ~/.aws/config
  • Environment variables like AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
  • Secret managers used by CI systems and deployment platforms

Troubleshooting tips

  • If the CLI reports an invalid signature update the credentials file and clear any cached credentials in your shell session.
  • If services fail after rotation double check role permissions and the principle of least privilege. New keys do not magically gain permissions.
  • Use CloudTrail to see where the old key was used before it was removed this helps you find forgotten places.

Security best practices that sound like nagging advice

Rotate keys regularly audit usage apply least privilege and prefer IAM roles for EC2 EKS and other AWS services where possible. Roles remove long lived secret access keys from compute nodes and reduce blast radius if something goes wrong.

Follow these steps and you will reduce the chance your S3 buckets EC2 instances and EKS clusters are used as someone else s playground. You may still get coffee on your keyboard but at least your keys will not be the problem.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.