AWS access keys enable us to use programmatic or AWS CLI services in a manner similar to using a username and password.
AWS access keys have account privileges – for better and for worse.
For example, if you save access keys (credentials) of a root account inside code, anyone who uses this code can totally damage your AWS account.
Many stories have been published about security breaches due to access key exposure, especially combined with open source version control systems such as GitHub and GitLab.
In order to avoid security breaches, here is a list of best practices for securing your environment when using access keys:
- Avoid using access keys for the root account. In case you already created access keys, delete them.
- Use minimum privileges when creating account roles.
- Use AWS IAM roles instead of using access keys, for resources such as Amazon EC2 instance.
- Use different access keys for each application, in order to minimize the risk of credential exposure.
- Protect access keys by storing them on encrypted machines or encrypted volumes, and avoid sending access keys via email or any other insecure medium.
- Rotate (change) access keys on a regular basis, to avoid reuse of credentials.
- Remove unused access keys, to avoid unnecessary access.
- Use MFA (Multi-factor authentication) for privileged operations/accounts.
- Configure billing alerts using Amazon CloudWatch, to get notifications about anomaly operations in your AWS account.
- Use AWS CloudTrail auditing to review when was an access key was last used.
- Use open source tools such as git-secrets to avoid storing passwords and sensitive information inside a GIT repository.
- Work according to GitHub recommendations and avoid using sensitive information in a public repository.