- Method 1: Long-lived programmatic credentials (IAM user)
- Method 2: AWS CLI v2
login(browser-based, short-lived) - Method 3: AWS IAM Identity Center (SSO) with a trusted IdP
- Method 4: CloudShell (console-embedded terminal using your console session)
Method 1 — Long-lived programmatic credentials (IAM user)
Historically, developers created an IAM user and generated programmatic credentials (an access key ID and a secret access key). These keys are stored locally (for example in~/.aws/credentials) and the AWS CLI reads them for every API call.
- Programmatic credentials cannot be used to sign in to the AWS Management Console.
- Typically stored in
~/.aws/credentialson a developer workstation or in environment variables for automation. - Simple to use, but high risk if leaked.
Long-lived access keys are high risk: if they are leaked, an attacker can use them until you rotate or revoke them. Prefer short-lived credentials (browser/OIDC/SAML/STS-based) where possible.
Method 2 — AWS CLI v2 login (browser-backed, short-lived credentials)
AWS CLI v2 provides a login command that opens a browser to authenticate your console identity and issues short-lived credentials for the CLI to use. This avoids storing long-lived keys on disk and maps CLI sessions to your browser authentication.
- The CLI attempts to open your default browser. If it cannot, it prints a URL you can copy/paste to authenticate.
- A named profile keeps session contexts separated so you can maintain multiple logged-in identities.

- After you authenticate in the browser, the CLI caches temporary programmatic credentials for the named profile.
- These credentials automatically expire and reduce long-term exposure compared to static access keys.
Tip: Use descriptive profile names (for example
bedrock-dev-profile) and keep different profiles for different accounts or roles to avoid accidental cross-account calls.Method 3 — AWS IAM Identity Center (SSO) with a trusted identity provider
Identity Center (formerly AWS Single Sign-On) is designed for organizations that manage multiple AWS accounts and want centralized authentication and authorization.- Identity Center is configured to trust an external identity provider (IdP) such as Microsoft Entra (formerly Azure AD).
- Users authenticate with their corporate identity; Identity Center issues temporary STS credentials and provides role mappings for different AWS accounts.
- The issued credentials are temporary and expire after the session duration configured in Identity Center.

- Centralizes identity and access management for large orgs.
- Simplifies role assignment across many accounts.
- Provides auditability and short-lived credentials for CLI/API access.
Method 4 — CloudShell (console-embedded terminal)
CloudShell is a browser-based shell that runs inside the AWS Management Console. It inherits the security context of your console session, so you don’t need to create or store keys locally.- CloudShell includes the AWS CLI preinstalled and supports multiple tabs, file upload/download, and split panes.
- The terminal session automatically uses temporary credentials from your console login and respects the currently selected AWS Region.
- Ideal for quick administrative tasks or when you can’t install a local CLI.

- The above is a control plane operation (AWS Bedrock API). Inference requests against Bedrock Runtime use separate runtime endpoints and may require different parameters.
- CloudShell runs in the region selected in the Management Console; open tabs in different regions if needed.
Summary and recommendations
- Avoid long-lived access keys for everyday developer use. Use them only when unavoidable and rotate frequently.
- Prefer short-lived credentials: AWS CLI v2
login, Identity Center (SSO), or CloudShell. - For enterprise multi-account environments, Identity Center with a trusted IdP (e.g., Microsoft Entra) offers the best scalability and centralized control.
- For quick, ad-hoc tasks in a browser, CloudShell provides a secure, zero-install CLI experience.
- AWS CLI v2 SSO/login: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html
- AWS IAM Identity Center: https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html
- AWS CloudShell: https://docs.aws.amazon.com/cloudshell/latest/userguide/what-is-cloudshell.html
- Amazon Bedrock documentation: https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-bedrock.html