---
title: "Getting Claude Code Up and Running using AWS Bedrock Claude Opus 4.5 Model (Long Term API Keys)"
type: post
url: "https://robotpaper.ai/getting-claude-code-up-and-running-using-aws-bedrock-claude-opus-4-5-model-no-aws-cli-no-iam-roles-or-users/"
canonical: "https://robotpaper.ai/getting-claude-code-up-and-running-using-aws-bedrock-claude-opus-4-5-model-no-aws-cli-no-iam-roles-or-users/"
markdown_url: "https://robotpaper.ai/getting-claude-code-up-and-running-using-aws-bedrock-claude-opus-4-5-model-no-aws-cli-no-iam-roles-or-users.md"
published: "2026-02-03T07:29:09.000+00:00"
updated: "2026-10-22T21:57:58.000+00:00"
tags: ["ClaudeCode", "AWS", "Tools"]
author: "Roy Osherove"
author_links: ["https://robotpaper.ai", "https://x.com/royosherove", "https://www.linkedin.com/in/osherove/", "https://forms.gle/jQSx5KoXvrVA1JCK7", "https://robotpaper.ai/about-roy.md"]
description: "How I got Claude Code running on AWS Bedrock with Claude Opus 4.5 using only environment variables and a long-term API key. No AWS CLI, IAM roles or users."
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original post)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Getting Claude Code Up and Running using AWS Bedrock Claude Opus 4.5 Model (Long Term API Keys)

What better time is there to try out a new tool or service than when joining a new company? *Well, I just* [*recently joined AWS*](https://www.linkedin.com/in/osherove/) *as a Sr. Solutions Architect. Yay! And that's my opportunity to try out a bunch of stuff that I get a chance to try so far.*

One of the tools I've yet to try deeply yet is Claude Code. I usually just used Cursor up until now. But I do love the terminal, and, AWS culture is all about trying things *your way* so here we are. First thing I did was try to get it working with Bedrock (why pay for a personal license when I can use AWS bedrock resources as an employee? Also for compliance reasons I can't use an external service API for coding internally :))

OK, once you've [installed claude code](https://code.claude.com/docs/en/setup) you will starting googling "claude code bedrock" and then you'll [come across this article](https://code.claude.com/docs/en/amazon-bedrock) on Anthropic. In there you'll see multiple ways of setting up and accessing a model. The most pain free way I've found so far is :

# Using Only Environment Variables, no AWS CLI, no IAM needed

-   Go with Environment variables only
-   No need to use *aws cli*
-   no need to use AWS IAM
-   You just need three things:
    -   your model's region (i.e us-east-1)
    -   your model's [*inference profile*](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-use.html) *id (in* [*ARN*](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html) *format)*
    -   generate a long running API key for use with your model

Here's an example of the full list of environment variables you need to set in your terminal (or in .claude/settings.json ) for claude code to function on bedrock:

```bash
# Required for Claude to switch to bedrock
export CLAUDE_CODE_USE_BEDROCK=1
# model region
export AWS_REGION="us-east-1"
# model long running API key
export AWS_BEARER_TOKEN_BEDROCK="ABS..."
# model ARN (inference profile ID)
export ANTHROPIC_MODEL="arn:aws:bedrock:us-east-1:12345678:inference-profile/eu.anthropic.claude-opus-4-5-20251101-v1:0"
# These seem to be the magical values Bedrock needs to work well with Claude for longer responses
export CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000
export MAX_THINKING_TOKENS=1024
```

-   Note that this "locks in" your claude code into a specific model. If you want to change a model later, you need to change the environment variable.

Here's what that might look like in .claude/settings.json:

```bash
{
  "env": {
    "CLAUDE_CODE_USE_BEDROCK": "1",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "AWS_BEARER_TOKEN_BEDROCK": "KEY-GOES-HERE"
  },
  "model": "us.anthropic.claude-opus-4-5-20251101-v1:0"
}
```

# Steps for Configuring it All in AWS Console

## AWS\_REGION: Choosing a region

1.  Go to the "bedrock" service
2.  Make sure you are in the region you want (top right)
3.  Use this region name in AWS\_REGION env var

## AWS\_BEARER\_TOKEN\_BEDROCK: Generating an API key

1.  Click on "Api Keys" on left hand side
2.  Click on "Long Term API Keys"
3.  Click "Generate Long Term API Key"
4.  Select expiration days for your key (a month? a year? up to you)
5.  If you want to get more access to other models, you can check the box that gives the API key access to marketplace models on AWS.
6.  Save the API key in your configuration env variables.

## ANTHROPIC\_MODEL: Getting the model's Inference Profile ARN (if not using the default)

1.  click on "Model Catalog" on left hand side and click on your model of choice
2.  Click on "open in playground" on top right

In the playground, click on three dots next to "compare mode" and click "view api request

![AWS Bedrock playground menu with the "View API request" option highlighted](https://robotpaper.ai/content/images/2026/02/image-2.png)

copy the ARN that occurs right after *\--model-id* parameter and use that in your env variables under ANTHROPIC\_MODEL

The rest of the environment variables stay pretty much the same:

```bash
export CLAUDE_CODE_USE_BEDROCK=1
export CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000
export MAX_THINKING_TOKENS=1024
```

Once all these Env vars are in your session, you can start up claude code, and you'll see that it automatically uses your chosen model. no AWS cli use required.

# Why?

-   I don't like creating an IAM user or role when it's not really needed.
-   I can provision an API key and monitor its usage later or cancel it
-   I like to keep things simple for my own use. The other options had too many steps. In this way I set my .zshrc profile and export variables once and I'm done.

---

## About the author

**Roy Osherove** - Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

-   [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
-   [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
-   [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
-   [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
-   [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
-   [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

-   X: [https://x.com/royosherove](https://x.com/royosherove)
-   LinkedIn: [https://www.linkedin.com/in/osherove/](https://www.linkedin.com/in/osherove/)

### Contact

-   Contact form: [https://forms.gle/jQSx5KoXvrVA1JCK7](https://forms.gle/jQSx5KoXvrVA1JCK7)

### License

Content on robotpaper.ai is licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/): reuse, quote and adapt with attribution (Roy Osherove, link to the original post).

More about Roy and his other sites and projects: [https://robotpaper.ai/about-roy.md](https://robotpaper.ai/about-roy.md)
