Skip to content

opensite-ai/opensite-skills / amazon-bedrock

amazon-bedrock

Flagged

Builds generative AI applications on Amazon Bedrock. Covers model invocation (Converse API, InvokeModel), RAG with Knowledge Bases, Bedrock Agents, Guardrails, and AgentCore (including the Harness managed agent loop). Applies when invoking models, setting up Knowledge Bases, creating agents, applying guardrails, deploying to AgentCore, migrating/porting/converting a Bedrock Agent (including inline agents) to an AgentCore Harness, troubleshooting Bedrock errors (ThrottlingException, AccessDeniedException), or choosing Bedrock models (Claude, Llama, Nova, Titan). Also for prompt caching, quota and throttling diagnosis, cost tracking, migrating between Claude model generations, chunking strategies, and Bedrock model selection. Covers AgentCore Payments (x402, microtransactions, Payment Manager, Connector, Instrument, Coinbase CDP, Stripe Privy, paid endpoints, agent payments). NOT for custom model training, Rekognition, or Comprehend. For SageMaker model discovery, customization, or endpoints, use aws-ai-ml.

FileKindSize
.aws-skill-metadataother18 B
SKILL.mdskill md34.1 KB
assets/kb_shim.py.tmplother3.4 KB
assets/lambda_shim.py.tmplother8.0 KB
assets/tool_schema.json.tmplother389 B
references/agentcore-credentials-and-security.mdmarkdown6.5 KB
references/agentcore-gateway.mdmarkdown7.0 KB
references/agentcore-harness.mdmarkdown22.0 KB
references/agentcore-memory-observability.mdmarkdown5.6 KB
references/agentcore-payments-setup-script.mdmarkdown12.3 KB
references/agentcore-payments-wiring.mdmarkdown12.1 KB
references/agentcore-payments.mdmarkdown19.5 KB
references/agentcore-registry-evaluations.mdmarkdown6.8 KB
references/agentcore-runtime-container-build.mdmarkdown10.4 KB
references/agentcore-runtime.mdmarkdown7.6 KB
references/agents-and-action-groups.mdmarkdown16.5 KB
references/bedrock-agents-to-agentcore-harness/cli.mdmarkdown2.0 KB
references/bedrock-agents-to-agentcore-harness/deploy.mdmarkdown12.0 KB
references/bedrock-agents-to-agentcore-harness/discovery.mdmarkdown3.9 KB
references/bedrock-agents-to-agentcore-harness/eligibility.mdmarkdown3.3 KB
references/bedrock-agents-to-agentcore-harness/mapping.mdmarkdown8.9 KB
references/cost-tracking.mdmarkdown4.5 KB
references/guardrails.mdmarkdown14.7 KB
references/knowledge-bases-decision-guide.mdmarkdown2.8 KB
references/knowledge-bases-retrieval.mdmarkdown8.3 KB
references/knowledge-bases-setup.mdmarkdown17.9 KB
references/managed-knowledge-bases-retrieval.mdmarkdown8.1 KB
references/managed-knowledge-bases-setup.mdmarkdown12.7 KB
references/migrate-bedrock-agents-to-agentcore-harness.mdmarkdown11.5 KB
references/model-invocation.mdmarkdown11.0 KB
references/model-migration.mdmarkdown4.3 KB
references/model-selection-guide.mdmarkdown7.4 KB
references/prompt-caching.mdmarkdown5.5 KB
references/prompt-engineering-by-model.mdmarkdown7.9 KB
references/quota-health.mdmarkdown4.3 KB
references/sdk-converse-api-python.mdmarkdown6.3 KB
references/sdk-converse-api-typescript.mdmarkdown6.5 KB
scripts/fetch_bedrock_agent.pyscript14.1 KB

references/agentcore-credentials-and-security.md

View on GitHub
# AgentCore Credentials & Security

## Table of Contents
- Credential Provider Patterns
- OAuth Three-Layer Architecture
- Cross-Account Access
- Security Best Practices
- Agent Persistence Patterns

## Credential Provider Patterns

Three authentication types for AgentCore services. Getting the wrong type causes hard-to-debug 401/403 errors.

### API Key Authentication

> **Security consideration:** API keys are long-lived credentials. Prefer IAM authentication (ephemeral, auto-rotated) or OAuth when the target supports it. Use API keys only when the external target requires them (e.g., third-party APIs that only accept API key auth).

```
Setup sequence:
1. Create credential provider with the API key value (transmitted over TLS/SigV4; service encrypts and stores it in Secrets Manager internally)
2. Attach credential provider to Gateway target
```

**Constraints:**
- You MUST NOT pass the API key as a literal value on the command line — shell history exposes it
- You MUST ask the user to set the key as an environment variable: `export API_KEY=<their-key>`
- You MUST create the credential provider: `aws bedrock-agentcore-control create-api-key-credential-provider --name <name> --api-key "$API_KEY"`
- The service stores the key in Secrets Manager internally (response includes `apiKeySecretArn`)
- For rotation: update the API key through the service's control plane: `aws bedrock-agentcore-control update-api-key-credential-provider --name <name> --api-key "$NEW_API_KEY"` — the service re-encrypts and stores the new key internally. Do not call `secretsmanager rotate-secret` directly on the service-managed secret.
- You MUST NOT hardcode API keys in agent code or configuration
- You MUST NOT log or display the API key value in agent output
- You SHOULD enable CloudTrail logging to audit all credential provider API calls — these are control plane management events (`CreateApiKeyCredentialProvider`, `UpdateApiKeyCredentialProvider`, `DeleteApiKeyCredentialProvider`) logged under `eventSource: bedrock-agentcore.amazonaws.com`
- Refer to [AWS security best practices for AgentCore](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/security.html)

### OAuth Authentication

**Constraints:**
- The client secret is passed via the `create-oauth2-credential-provider` API call (the service encrypts and stores it in Secrets Manager automatically — response includes `clientSecretArn`)
- You MUST NOT hardcode client secrets in agent code or configuration
- You MUST NOT log or display client secret values in agent output
- Configure: token endpoint URL, client ID, scopes, grant type
- Create the OAuth2 credential provider: `aws bedrock-agentcore-control create-oauth2-credential-provider --name <name> --credential-provider-vendor <vendor> --oauth2-provider-config-input '...'`
- Refer to the latest AWS documentation on AgentCore OAuth configuration for current supported grant types and vendor options

### IAM Authentication

For Lambda targets and cross-service communication:
- Service roles for AgentCore services
- Cross-service permissions: Runtime → Gateway → external API
- Resource-based policies for cross-account access
- No credential provider needed — IAM handles authentication

## OAuth Three-Layer Architecture

AgentCore has three distinct OAuth layers — agents confuse these:

| Layer | Direction | Purpose |
|-------|-----------|---------|
| **Inbound JWT** | Caller → AgentCore | Validate tokens from callers (Cognito, external IdPs) |
| **Outbound Credential Provider** | Agent → External API | Agent authenticating to external APIs via Gateway |
| **Gateway OAuth** | Gateway → Upstream MCP | Gateway authenticating to upstream MCP servers |

Each layer is configured independently. Getting the wrong layer causes auth failures that look identical (401/403) but have different root causes.

**Supported IdPs for inbound JWT**: Cognito, Okta, Auth0, Azure AD, custom OIDC.

Refer to the latest AWS documentation on AgentCore OAuth architecture for current configuration steps and CDK examples.

## Cross-Account Access

Cross-account Bedrock access requires IAM trust policies on both sides.

**Pattern:**
1. **Calling account**: IAM role with `bedrock:InvokeModel` permission and `sts:AssumeRole` to the target account's role
2. **Target account**: IAM role with trust policy allowing the calling account's principal, plus `bedrock:InvokeModel` permission

**Trust policy pattern (target account role):**
```json
{
  "Effect": "Allow",
  "Principal": {"AWS": "arn:aws:iam::<calling-account-id>:role/<role-name>"},
  "Action": "sts:AssumeRole",
  "Condition": {
    "StringEquals": {
      "sts:ExternalId": "<agreed-external-id>"
    }
  }
}
```

Include `sts:ExternalId` for confused deputy protection. For service-to-service access, use `aws:SourceArn` and `aws:SourceAccount` conditions instead.

**Common failure**: `AccessDeniedException` when calling Bedrock from a different account — verify:
- Trust policy includes the calling account's principal ARN (not just account ID)
- The assumed role has `bedrock:InvokeModel` permission in the target account
- Model access is enabled in the target account's region

Refer to the latest AWS documentation on Bedrock cross-account access for current IAM policy patterns and any service-specific conditions.

## Security Best Practices

| Practice | How |
|----------|-----|
| Resource-based policies | Restrict access to specific principals, accounts, VPCs |
| VPC endpoints | Private AgentCore access without internet traversal |
| IP restrictions | Limit access by source IP range |
| Encryption | Data encrypted at rest and in transit by default |
| Audit logging | Enable CloudTrail for all AgentCore API calls |
| Least privilege | Grant only required permissions per service role |

## Agent Persistence Patterns

Deploying framework-specific agents on AgentCore Runtime:

| Framework | Key Configuration |
|-----------|------------------|
| **Strands Agents** | S3 for file storage, session state via Memory service |
| **LangChain/LangGraph** | Standard Python deployment, state management via Memory |
| **Custom frameworks** | Implement the protocol contract (HTTP/MCP/A2A/AG-UI) |

Refer to the latest AWS documentation on AgentCore deployment for the relevant framework.

**Constraints:**
- All frameworks MUST meet the container contract: ARM64, health check, correct port
- See [container build procedure](agentcore-runtime-container-build.md) for the build workflow
- State persistence SHOULD use the Memory service rather than local filesystem (containers are ephemeral)
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall