Communityライティング&編集github.com

AgentCore リソースを IaC として生成

Amazon Bedrock AgentCore リソース(Runtime、Gateway、Identity、Memory)を、Terraform モジュールまたは CDK スタックとして IaC でスキャフォールドします。

AgentCore リソースを IaC として生成 とは?

このスキルは、Amazon Bedrock AgentCore の各リソース(Runtime、Gateway、Identity、Memory)を、チームのコードベースに統合できる Terraform モジュールまたは TypeScript CDK スタックとして生成します。生成されるモジュールは平坦でコメントが豊富に付与され、シークレットは書き込み専用、ゲートウェイには常に認証局が設定されます。まず `agentcore-discover` スキルで既存の構成を検出し、`--dry-run` で差分計画を表示した上でユーザーの確認を得てから書き込みを行い、既存ファイルを上書きする際は `--force` が必要です。推奨は Terraform モジュールですが、CDK または AgentCore CLI コマンドによる代替も提供されます。書き込み後は `agentcore-review` スキルで自動レビューを実行し、結果をユーザーに提示します。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/alexaiarchitect/agentcore-skills/tree/HEAD/skills/agentcore-create

Installed? Explore more ライティング&編集 skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

AgentCore リソースを IaC として作成

新しい AgentCore リソースは、誰も再現できないコンソールのクリックではなく、チームがデプロイする他のすべてのリソースと同じツリー内でレビューされたモジュールとして作成されるべきです。このスキルは、ユーザーがルートモジュールから配線する、小さくフラットな Terraform モジュール(main.tf、variables.tf、outputs.tf、versions.tf)を作成します。各モジュールは意図的に簡素に保たれており、すべての引数はコメントで説明され、シークレットは書き込み専用、ゲートウェイは認証局なしでは決して作成されません。

${CLAUDE_SKILL_DIR} はスキルランタイムによってこのスキル自身のディレクトリに設定されます。以下のすべてのコマンドでそのまま使用してください。兄弟スキルのスクリプトは ${CLAUDE_SKILL_DIR}/../<skill>/scripts/ にあります。

フロー

  1. まず検出 — モジュールを既存のモジュールの隣に配置し、リージョンを把握します:

    python3 ${CLAUDE_SKILL_DIR}/../agentcore-discover/scripts/discover.py <project> --focus agentcore,region,terraform
    

    すでに AgentCore CLI または CDK が AgentCore リソースを所有している場合(DSC004 領域)、代わりに一致する --iac を提供します。

  2. 書き込み計画を立てます。

    python3 ${CLAUDE_SKILL_DIR}/scripts/scaffold.py <project> --component runtime --dry-run
    

    --component gateway|identity|memory、--iac terraform|cdk|cli、--name、--out-dir、--protocol HTTP|MCP|A2A|AGUI(runtime)。

  3. オプション。 Terraform モジュール(推奨、無料)、CDK スタック(無料)、または AgentCore CLI コマンド(表示は無料、agentcore deploy 自体は aws)。

  4. 確認 — AskUserQuestion で確認した後、同じコマンドを --dry-run なしで実行します。--force は、ユーザーが計画を確認した後にファイルを置き換えるよう依頼した場合のみ渡します。

  5. 検証。 結果に対してレビューを実行し、表示します:

    python3 ${CLAUDE_SKILL_DIR}/../agentcore-review/scripts/review.py <project>
    

決定ルール

  • Terraform 優先。 最初のユーザーが実行するものであり、このプラグインのレビュー、デプロイ計画、CI ポリシーのすべてが適用される唯一のオプションです。hashicorp/aws プロバイダーはすべてのコアリソースをカバーしています。awscc または CLI が必要なものについては provider-coverage.md を参照してください。
  • モジュールは配線され、適用されません。 スクリプトは追加する module ブロックを表示しますが、ルートモジュールを編集することはありません。
  • 書き込み専用シークレットには Terraform 1.11+ が必要です。 生成される versions.tf にそのように記載されています。古い Terraform では機密変数を使用し、シークレットがステートに残ることを受け入れる必要があります(ACR031)。
  • スターターキットは提供されません。 その CLI はサポート終了です。AgentCore CLI が CLI 代替案です。

リファレンス

質問ファイル
各生成モジュールの内容と理由terraform-modules.md
CDK と AgentCore CLI のパス、および選択基準cdk-and-cli-alternatives.md
hashicorp/aws がカバーするリソース、awscc と CLI のフォールバックprovider-coverage.md

スクリプト

コマンド動作終了コード
scripts/scaffold.py <project> --component C [--iac terraform|cdk|cli] [--dry-run] [--force] [--json]モジュール、CDK スタックを計画して書き込むか、CLI コマンドを表示する0 書き込み/計画済み、1 書き込むものなし、2 引数エラー

完了チェックリスト

  • 検出が実行され、選択された IaC がすでに AgentCore リソースを所有しているものと一致している。
  • --dry-run から書き込み計画が表示され、書き込み前に確認された。
  • module 配線ブロックがユーザーに提示され、ルートモジュールに書き込まれなかった。
  • review.py が結果に対して実行され、その結果が表示された。

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

alexaiarchitect/agentcore-skills

>- Put Amazon Bedrock AgentCore infrastructure behind a plan-only CI gate. Generates a GitHub Actions workflow that, on pull requests touching the infrastructure, runs the static AgentCore review (`ACR0xx`), `terraform fmt -check`, `init`, `validate`, a saved `plan` (Terraform or Terragrunt) with a read-only OIDC role, `show -json`, and the plan policy (`CI0xx`: no delete or replace of memories, gateways, credential providers, workload identities, user pools or tables without an explicit per-address allowance; no `*` on `*`; no gateway with `authorizer_type = NONE`; pinned MCP revisions), then uploads the plan JSON. Nothing in it applies. The plugin's stdlib-only library is vendored into `ci/agentcore/` so the job needs nothing from the plugin, and action pins are reused from the repository's own SHA-pinned workflows. `policy_check.py` also runs locally on any saved plan. Use when asked to "add CI for the AgentCore Terraform", "gate the plan", "block destructive changes", "policy check the plan", "plan on ...

alexaiarchitect/agentcore-skills

>- Estimate what Amazon Bedrock AgentCore will cost per month from a usage profile, line by line with the formula for each line, and put a budget and a usage alarm around it. Prices the published AgentCore rate card (Gateway invocations, search and tool indexing; Identity token requests, free through Runtime or Gateway; Runtime vCPU-hours billed only while active and GB-hours; Memory short-term events — per 1,000 events until 2026-10-05, per GB from 2026-10-06 — and long-term records and retrievals; Evaluations tokens), prices model tokens only at the user's own per-1,000 rates, and lists what it does not price (Lambda, API Gateway, CloudWatch, X-Ray, DynamoDB) so the total is never mistaken for the bill. Generates an AWS Budget filtered to AgentCore with forecast and actual alerts, plus a CloudWatch alarm on gateway invocations, as Terraform after a dry run. Findings are the `CST0xx` band. Use when asked "what will AgentCore cost", "estimate the gateway bill", "is there a free tier", "memory pricing chang...

alexaiarchitect/agentcore-skills

>- Plan the deployment of Amazon Bedrock AgentCore infrastructure and its rollback, and hand the user the exact commands — never running them. Finds the root module (or Terragrunt stack) that actually reaches the AgentCore resources, orders what comes up (identity and roles, then gateway, runtime and memory, then targets and strategies, then log delivery), flags where a first apply trips (IAM propagation, creation-only semantic search, Transaction Search before TRACES delivery, an old provider lock, no remote backend), checks published quotas (targets per gateway, tools per target), and emits init / validate / plan-to-file / show -json / policy check / apply of that saved plan, the post-apply checks, and the rollback for each kind of change. Findings are the `DPL0xx` band; the cost tier is `aws` because the commands create billable resources. Use when asked to "deploy the gateway", "apply this", "what order do I apply in", "how do I roll back", "will this hit a quota", "give me the terraform commands". Don...

alexaiarchitect/agentcore-skills

>- Inventory a project for Amazon Bedrock AgentCore work and report before advising. Finds existing AgentCore resources and which tool owns them (Terraform `aws_bedrockagentcore_*`/`awscc_*`, CDK constructs, the AgentCore CLI's `agentcore.json`, the deprecated starter toolkit's `.bedrock_agentcore.yaml`, boto3 `bedrock-agentcore` clients, the AgentCore Python SDK and `@requires_access_token`), the agent framework (Strands, LangGraph, LangChain, Claude Agent SDK, CrewAI, OpenAI Agents, ADK, raw), MCP servers and the API Gateway routes and Lambdas behind `/mcp`, Cognito pools, clients and JWT authorizers, the AWS region and per-service availability there, the hashicorp/aws constraint and lock, Terragrunt, and Lambda tracing. Read-only; findings are the `DSC0xx` band. Use when asked "what do I have", "is this on AgentCore", "inventory this repo", "which region are we in", "is AgentCore available in eu-central-1", "what framework is this agent", or before any other AgentCore skill on an unfamiliar project. Don...

関連スキル