Skip to content

Add backup tool and document architecture rules for Copilot CLI#361

Merged
colinmxs merged 2 commits into
developfrom
migration-script
May 20, 2026
Merged

Add backup tool and document architecture rules for Copilot CLI#361
colinmxs merged 2 commits into
developfrom
migration-script

Conversation

@colinmxs
Copy link
Copy Markdown
Contributor

This pull request introduces a comprehensive, one-shot pre-migration backup tool for the AgentCore Public Stack. It provides a GitHub Actions workflow and a Python script (with supporting documentation and schema) to export all critical application data—including DynamoDB tables, S3 buckets, Cognito configuration, and AgentCore Memory—into a secure, portable S3 bucket. The backup is designed to be restore-friendly, with a clear manifest and strong conventions for sensitive data handling. The PR also includes detailed documentation and a manifest schema for verification and future restore steps.

Major additions and changes:

Backup Tool Implementation:

  • Added a new backup tool in scripts/backup-data/ with a Python 3.13 environment and strict dependency management, supporting full export of DynamoDB, S3, Cognito, and AgentCore Memory data. The tool is designed for portability and later restoration into a new infrastructure shape. [1] [2]

GitHub Actions Workflow:

  • Introduced .github/workflows/backup-data.yml, a manual-dispatch workflow that orchestrates the backup process, passing environment-specific parameters and securely handling AWS credentials via OIDC. Supports dry-run, partial backup, and ephemeral table inclusion options.

Documentation and Usage Guides:

  • Added scripts/backup-data/README.md with detailed instructions, IAM policy requirements, sensitive data warnings, and a verification checklist to ensure backup integrity and security.
  • Added .github/copilot-instructions.md to clarify repository conventions, architecture, build/test/lint procedures, and debugging tips for contributors.

Schema and Verification:

  • Introduced scripts/backup-data/manifest_schema.json, a JSON schema that defines the structure of the backup manifest, ensuring each backup is verifiable and machine-readable for future restore operations.

Dependency Management:

  • Added pyproject.toml for the backup tool, specifying pinned dependencies for both runtime and development (including test and mock libraries for AWS services).

colinmxs and others added 2 commits May 20, 2026 12:05
Distills architecture rules (3-package import boundary, inference-api Runtime 404 trap, deploy order, SSE error model), conventions, and file-placement table. Points to .kiro/steering and .claude/skills for deeper dives.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Smith <7762103+colinmxs@users.noreply.github.com>
Adds scripts/backup-data/ — a one-shot uv-managed Python tool that takes a complete, restore-friendly backup of all application data and users for a given CDK_PROJECT_PREFIX, plus a workflow_dispatch GitHub Actions workflow that runs it via the existing OIDC composite action.

Coverage: all ~20 application DynamoDB tables (via ExportTableToPointInTime for portable DynamoDB-JSON), user-content S3 buckets (via aws s3 sync), full Cognito user pool config including identity providers and app clients with their plaintext client secrets preserved (so IdP re-registration with the new infra can be fully automated), users / groups / group memberships, and best-effort AgentCore Memory events.

Each run lands in a freshly-created, versioned, SSE-encrypted, TLS-only backup bucket named {prefix}-backup-{utc_timestamp}. manifest.json is the single source of truth a future restore script will consume. Cognito password hashes are not exportable by AWS and that limitation is documented prominently. Ephemeral session/state tables are excluded by default.

Restore is intentionally a separate phase, to be written against the new infrastructure once it exists.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Smith <7762103+colinmxs@users.noreply.github.com>
@colinmxs colinmxs merged commit bf4c216 into develop May 20, 2026
1 check passed
colinmxs added a commit that referenced this pull request May 22, 2026
Merges 16 commits from origin/develop into the stack-simplification
branch. Two modify/delete conflicts resolved (mcp-sandbox-stack.ts and
its test — both deleted by us, modified by develop's PRs #352#360).

Ported the dynamic per-resource CSP changes from develop into
constructs/mcp-sandbox/mcp-sandbox-distribution-construct.ts:

  - Removed buildMcpSandboxProxyCsp() (static CSP is gone)
  - Added loadMcpSandboxCspFunctionCode() — loads csp-function.js from
    assets/mcp-sandbox/, substitutes the FRAME_ANCESTORS placeholder
    with the real source list via JSON.stringify (handles quote-escaping
    for 'none' correctly)
  - Added McpSandboxCspFunction (CloudFront Function, JS_2_0 runtime)
    associated at VIEWER_RESPONSE on the default behavior — composes
    per-resource CSP from ?csp= query param
  - Removed contentSecurityPolicy from the ResponseHeadersPolicy (CSP
    is now dynamic via the function; other security headers stay on RHP)
  - Shortened RHP comment to fit 128-char AWS cap

The mcp-sandbox-csp-function.test.ts that came in from develop passes
against our construct (88 tests green).

Also merged: file-sources adapter framework (#366, #367), frontend
test fix (#368), beta.27 release merges (#365, #369), kaizen doc (#370),
backup tool (#361 — already cherry-picked earlier).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant