agentleFS
aws-samplesaws-samples/anthropic-on-aws/.claude/skills/claude-platform-on-aws/SKILL.md

claude-platform-on-aws

Skill443 starsChanged 3 months agoMIT-0View on GitHub

Convert Anthropic 1P (direct API) code samples to Claude Platform on AWS (CPOA). Use when migrating from api.anthropic.com to aws-external-anthropic.{region}.api.aws, converting auth to IAM SigV4 or CPOA API key, adding workspace headers, adapting self-hosted sandbox workers for CPOA, or when someone asks about differences between Anthropic 1P and CPOA authentication/endpoints. Triggers on phrases like "convert to CPOA", "migrate to Claude Platform on AWS", "CPOA auth", "workspace header", "aws-external-anthropic", "SigV4 anthropic".

  • Installs packages

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use the EnvironmentWorker SDK helper (from anthropic.lib.environments) or call GET /v1/environments/{id}/work/poll directly

    line 61
  2. Distinctive:

    No long-lived secrets — IAM creds rotate hourly via STS

    line 75

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Claude Platform on AWS — Migration Skill

Convert Anthropic 1P API code to Claude Platform on AWS (CPOA).

Key Differences: 1P vs CPOA

AspectAnthropic 1PCPOA
Base URLhttps://api.anthropic.comhttps://aws-external-anthropic.{region}.api.aws
AuthAPI key (sk-ant-api03-...) in x-api-key headerIAM SigV4 OR CPOA API key (generated in AWS Console)
Required headersx-api-key, anthropic-versionanthropic-workspace-id (handled by platform SDK clients)
SDK clientAnthropicAnthropicAWS (Python) / AnthropicAws (TypeScript)
BillingAnthropic billingAWS Marketplace
InferenceAnthropic infraAnthropic infra (same — CPOA only changes auth/billing layer)
Env keys (self-hosted workers)sk-ant-oat01-... (from Claude Console)NOT used — workers authenticate via IAM or CPOA API key
VPC accessDirect HTTPS to api.anthropic.comPrivateLink available (VPC→AWS hop only; inference still on Anthropic)
Credential rotationManual API key managementAutomatic via STS (IAM mode)

Conversion Steps

1. Identify Auth Mode

CPOA supports two auth modes:

  • IAM SigV4 (preferred for production): Uses execution role credentials via standard AWS provider chain. No secrets to manage.
  • API key (dev/quick-start): Generated in AWS Console under Claude Platform on AWS → API keys. Short-term tokens generated from AWS credentials default to 12 hours (capped at the lesser of requested duration, AWS credentials' expiry, and 12 hours).

2. Install the Platform SDK

The platform-specific SDK client handles SigV4 signing, base URL construction, and the anthropic-workspace-id header automatically.

# Python
pip install -U "anthropic[aws]"

# TypeScript
npm install @anthropic-ai/aws-sdk

3. Convert Client Initialization

See references/code-patterns.md for language-specific conversion patterns (Python, Node.js, curl).

The platform client reads AWS_REGION and ANTHROPIC_AWS_WORKSPACE_ID from environment variables. Set them:

export AWS_REGION='us-west-2'
export ANTHROPIC_AWS_WORKSPACE_ID='wrkspc_XXXXX'

4. Update Self-Hosted Sandbox Workers

For self-hosted environments on CPOA:

  • Environment keys from the Claude Console do not work on the CPOA endpoint
  • Workers authenticate via IAM (attach AnthropicSelfHostedEnvironmentAccess policy) or CPOA API key
  • Use the EnvironmentWorker SDK helper (from anthropic.lib.environments) or call GET /v1/environments/{id}/work/poll directly

5. IAM Permissions

Different policies for different use cases:

  • Inference (/v1/messages): Attach AnthropicInferenceAccess managed policy (includes CreateInference)
  • Self-hosted workers: Attach AnthropicSelfHostedEnvironmentAccess managed policy (includes ProcessEnvironmentWork, GetEnvironment, GetSession, UpdateSession, GetSkill, CallWithBearerToken — but NOT CreateInference)

A role with only AnthropicSelfHostedEnvironmentAccess will 403 on /v1/messages. Combine both policies if the worker also needs to make inference calls.

6. Security Comparison

CPOA advantages for sandboxed/multi-tenant environments:

  • No long-lived secrets — IAM creds rotate hourly via STS
  • IAM policy scoping — restrict to specific actions
  • Condition keys — aws:SourceVpc, aws:SourceAccount
  • CloudTrail audit — native AWS logging
  • SCP enforcement at org level

Tradeoff: more operational complexity (IAM setup, workspace subscription, outbound web identity federation enablement).

Common Pitfalls

  1. Missing workspace header → 400 error. Use the platform SDK client (AnthropicAWS/AnthropicAws) which adds it automatically, or set ANTHROPIC_AWS_WORKSPACE_ID env var.
  2. Outbound web identity federation disabled → Every request fails with "Outbound web identity federation is disabled for your account". Run aws iam enable-outbound-web-identity-federation once per AWS account.
  3. Using Claude Console environment keys on CPOA → Won't work. Workers on CPOA authenticate via IAM or CPOA API key instead.
  4. Confusing IAM policies → AnthropicSelfHostedEnvironmentAccess does NOT grant inference. Need AnthropicInferenceAccess for /v1/messages.
  5. Region not set → Unlike AnthropicBedrock (which falls back to us-east-1), the platform client raises an error if no region is set.
  6. Account not CPOA-subscribed → SigV4 will fail; ensure the AWS account has completed Claude Platform on AWS sign-up.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.