Ensure that long-term Amazon Bedrock API keys are detected and removed from your AWS account in order to prevent persistent credential exposure risks, as these keys have been observed leaking to public repositories and represent a critical security vulnerability.
Programmatic access to the API requires authentication with AWS credentials. Amazon Bedrock enables you to generate dedicated API keys, which can be used as credentials when issuing API requests. These keys can be seamlessly integrated into your setup for automatic recognition. Amazon Bedrock offers two types of API keys: short-term and long-term keys. Short-term keys are valid for up to 12 hours or the length of your generating IAM session, inheriting that principal's permissions and restricted to the creation region. They are the preferred choice for production due to their limited lifespan, enabling regular credential rotation for greater security. In contrast, long-term keys offer a quick, one-click option for basic API access, ideal for first-time users exploring Bedrock without immediate IAM configuration. Users should favor short-term keys because they significantly reduce the security risk and the potential "blast radius" of a compromise, aligning with AWS security best practices that mandate temporary credentials over static, long-lived ones whenever possible. This preference ensures better overall security posture by minimizing exposure time.
Audit
To determine if long-term Amazon Bedrock API keys are available in your AWS cloud account, perform the following operations:
Remediation / Resolution
To prevent credential exposure, remove the long-term Amazon Bedrock API keys from your AWS account. To delete the long-term API keys, perform the following operations:
References
- AWS Documentation
- Programmatic access with AWS security credentials
- How Amazon Bedrock API keys work
- Generate Amazon Bedrock API keys to easily authenticate to the Amazon Bedrock API
- Handle compromised long-term and short-term Amazon Bedrock API keys
- AWS Command Line Interface (CLI) Documentation
- list-service-specific-credentials
- delete-service-specific-credential
- detach-user-policy
- delete-user