Choosing Credentials for Accessing Foundation Models
This lesson explains how applications and tools authenticate to Amazon Bedrock with IAM credentials or Bedrock API keys, and how to select the appropriate credential type.
Learning outcomes
After completing this lesson, you will be able to:
- Use temporary IAM credentials from roles.
- Distinguish short-term and long-term Bedrock API keys.
- Choose and control credentials for each caller.
IAM credentials
Bedrock API calls are normally signed with AWS Signature Version 4 using IAM credentials. The recommended form is temporary credentials from an IAM role: Lambda, ECS, EKS, EC2 and SageMaker AI workloads receive them automatically from their roles, and people use IAM Identity Center or federation. Temporary credentials expire and rotate automatically, and roles can be scoped to specific models, inference profiles and guardrails. Long-term IAM user access keys are discouraged.
Amazon Bedrock API keys
Bedrock API keys let tools and SDKs that expect a simple bearer token call Bedrock without SigV4 signing. Short-term API keys are generated from an existing identity's session, inherit its permissions, and last up to 12 hours or until the session ends, whichever comes first; they cannot be revoked individually, so revocation means acting on the identity. Long-term API keys are associated with an IAM user (a service-specific credential), have an expiry chosen at creation (from one day to no expiry), and each IAM user can have up to two for rotation. AWS recommends long-term keys only for exploration and development.
12hours
Longest life of a short-term Bedrock API key
Which credential?
Choosing and controlling credentials
Applications and tools need credentials to call foundation models, and the right type depends on where they run. Production workloads on AWS use IAM roles, which provide temporary credentials that rotate automatically. Short-term Bedrock API keys suit temporary access from tools that require a key. Long-term API keys should be used only where unavoidable, with short expiry, storage in AWS Secrets Manager, least-privilege permissions and monitoring of their use.
Administrators can restrict or block API keys with IAM conditions and service control policies, for example denying the creation of long-term keys or denying calls authenticated with them. The following table summarises the options.
| Credential | Lifetime | Best for | Cautions |
|---|---|---|---|
| IAM role temporary credentials | Short, auto-rotated | Production workloads | Scope role to needed models |
| Short-term Bedrock API key | Up to 12 hours or session | Temporary tool access | Inherits caller's permissions |
| Long-term Bedrock API key | Chosen expiry, IAM user | Exploration, key-only tools | Store in Secrets Manager, rotate, restrict |
| IAM user access keys | Long-lived | Avoid | Leak risk |
The following diagram matches three callers of Amazon Bedrock to the credential that suits each.

Controlling Bedrock access
Three callers
A company has three callers of Bedrock.
| Caller | Credential | Reason |
|---|---|---|
| Production chatbot on ECS Fargate | Task IAM role | Temporary, rotated, no secrets to manage |
| Analyst trying a third-party notebook tool that only accepts an API key for one afternoon | Short-term API key | Expires with the session |
| Legacy on-premises tool that only supports a static key | Long-term API key with 30-day expiry in Secrets Manager | No alternative; limit exposure |
An SCP prevents long-term keys in production accounts, so the exception is confined to a controlled account.
Which credentials should production workloads use to call Bedrock?
Show answer
IAM roles with temporary credentials. Long-term API keys are for exploration only.
Exam Tips
Remember for the exam
- Production workloads: IAM roles with temporary credentials.
- Short-term Bedrock API keys last up to 12 hours or the session and inherit permissions.
- Long-term Bedrock API keys belong to an IAM user; use for exploration only.
- Store any long-term key in Secrets Manager with short expiry.
- Block or restrict API keys with IAM conditions and SCPs.