0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Claude Platform on AWS で VS Code の Claude Code を動かす

0
Last updated at Posted at 2026-05-12

はじめに

2026年5月11日、Claude Platform on AWS が一般提供(GA)されました。

これにより、AWSアカウントを持つエンジニアは、Anthropic の Claude Platform をネイティブな形で利用できるようになりました。IAM認証・CloudTrail監査・AWS統合請求に対応しており、既存のAWS環境に自然に組み込めます。

本記事では、VS Code の Claude Code を Bedrock 経由から Claude Platform on AWS に切り替える手順を、実際のエラーと解消方法を含めて紹介します。


Claude Platform on AWS とは

Amazon Bedrock との違い

両者はどちらも AWS アカウントから Claude を利用できますが、アーキテクチャが根本的に異なります。

項目 Amazon Bedrock Claude Platform on AWS
運営者 AWS Anthropic
データ処理場所 AWS 境界内 AWS 境界外(Anthropic インフラ)
新機能リリース 遅延あり ネイティブAPIと同日
Guardrails / Knowledge Bases
Managed Agents / Skills / MCP connector
認証 AWS IAM AWS IAM(SigV4 or APIキー)
請求 AWS直接 AWS Marketplace経由
データレジデンシー要件 厳格な要件に対応 要件がない場合に最適

使い分けの基準

  • Bedrock を継続すべき場合:データをAWS境界内に留める必要がある、Guardrails/Knowledge Bases が必要、複数モデルを並行利用する
  • Claude Platform on AWS が適切な場合:Anthropicの最新機能をすぐ使いたい、Managed Agents・Skills・MCP connector が必要、データレジデンシー制約がない

作業環境

  • AWS アカウント(IAM 操作権限あり)
  • VS Code + Claude Code 拡張インストール済み
  • AWS CLI インストール・設定済み
  • Claude Platform on AWS のアクティベーション完了(AWS Marketplace から)

VS Code の settings.json 設定

settings.json(Claude Code の設定ファイル)に以下を追加します。

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "env": {
    "CLAUDE_CODE_USE_ANTHROPIC_AWS": "1",
    "ANTHROPIC_AWS_WORKSPACE_ID": "wrkspc_xxxxxxxxxxxxxxxxxxxx",
    "AWS_REGION": "ap-northeast-1"
  }
}
環境変数 説明
CLAUDE_CODE_USE_ANTHROPIC_AWS Claude Platform on AWS を使用する宣言
ANTHROPIC_AWS_WORKSPACE_ID AWS コンソールの Claude Platform on AWS → Workspaces で確認
AWS_REGION ワークスペースを作成したリージョン(東京なら ap-northeast-1

IAM 権限の設定

この設定が必要なケース

ローカルマシンから直接開発している場合は、AWS CLI の認証情報(~/.aws/credentials や SSO)がそのまま使われるため、IAM ユーザー/ロールに権限を付与するだけで済みます。

EC2 インスタンスにリモート SSH 接続して開発している場合(VS Code の Remote SSH 拡張など)は、Claude Code が EC2 上で動作するため、EC2 インスタンスにアタッチされている IAM ロールに権限を付与する必要があります。本記事はこのケースを前提としています。

Claude Platform on AWS を利用するには、対象の IAM ロールに以下の権限が必要です。

AWS マネージドポリシーを使う(推奨)

AWS が提供するマネージドポリシーを使うのが最もシンプルです。今後の権限変更にも自動追随します。

ポリシー名 付与される権限 用途
AnthropicFullAccess 全アクション(aws-external-anthropic:* 開発用途・個人利用に最適
AnthropicInferenceAccess 推論・バッチ処理 + 全リソースの読み取り 本番環境での推論利用(最小権限に近い)
AnthropicLimitedAccess AnthropicInferenceAccess の全権限 + Managed Agents の書き込み エージェント機能も使う場合
AnthropicReadOnlyAccess 全リソースの読み取りのみ(Get*List* 監査・モニタリング用途

EC2インスタンスのロールにアタッチする例:

aws iam attach-role-policy \
  --role-name "YOUR_ROLE_NAME" \
  --policy-arn "arn:aws:iam::aws:policy/AnthropicFullAccess"

設定確認:

aws iam list-attached-role-policies --role-name "YOUR_ROLE_NAME"

Outbound Web Identity Federation の確認

Claude Platform on AWS のゲートウェイは、内部で sts:GetWebIdentityToken を呼び出して JWT を生成します。この機能はAWSアカウントでデフォルト無効になっているため、1回だけ有効化が必要です。

有効化コマンド:

aws iam enable-outbound-web-identity-federation

既に有効な場合は (FeatureEnabled) ... already enabled と表示されます。

確認コマンド:

aws iam get-outbound-web-identity-federation-info

遭遇したエラーと対処法

エラー1:aws-external-anthropic:CreateInference が許可されていない

403 ... is not authorized to perform: aws-external-anthropic:CreateInference

原因:IAM ロールに Claude Platform on AWS の実行権限がない。

対処AnthropicFullAccess(または AnthropicInferenceAccess)をアタッチする。


エラー2:sts:GetWebIdentityToken が許可されていない

403 ... is not authorized to perform: sts:GetWebIdentityToken

原因:Outbound web identity federation が無効、またはIAMポリシーに sts:GetWebIdentityToken が含まれていない。

対処aws iam enable-outbound-web-identity-federation を実行する。マネージドポリシーを使用している場合は自動的に含まれる。


エラー3:sts:TagGetWebIdentityToken が許可されていない

403 ... is not authorized to perform: sts:TagGetWebIdentityToken

原因:タグ付き一時認証情報の取得権限が不足している。

対処:自前ポリシーを使っている場合は sts:TagGetWebIdentityToken を追加する。マネージドポリシー(AnthropicFullAccess 等)を使用している場合は自動的に解決されるため、マネージドポリシーの使用を推奨。


エラー4:/login 時に org:create_api_key scope is not available

認証に失敗しました
org:create_api_key scope is not available for this organization

原因:Claude Platform on AWS は /login(OAuthフロー)非対応。IAM認証(SigV4)を使う。

対処/login は不要。settings.json の環境変数設定と IAM 権限が正しければ自動的に IAM 認証で接続される。


動作確認

VS Code で Ctrl + Shift + PReload Window を実行後、Claude Code に話しかけて応答が返れば設定完了です。


まとめ

Claude Platform on AWS を使うための要点は3つです。

  1. settings.jsonCLAUDE_CODE_USE_ANTHROPIC_AWSANTHROPIC_AWS_WORKSPACE_IDAWS_REGION を設定
  2. IAM ロールに AnthropicFullAccess(または AnthropicInferenceAccess)をアタッチ
  3. aws iam enable-outbound-web-identity-federation を1回実行

トラブルシューティングのポイントは、自前ポリシーより AWS マネージドポリシーを使うことです。sts:GetWebIdentityTokensts:TagGetWebIdentityToken など、必要な権限が今後追加されても自動追随してくれます。


参考リンク

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?