Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# OS
.DS_Store
Thumbs.db

# AI assistant config
CLAUDE.md

# Environment and secrets
.env
*.env
.env.*

# Terraform
.terraform/
*.tfstate
*.tfstate.*
*.tfvars
*.tfvars.json
crash.log
override.tf
override.tf.json
*_override.tf
*_override.tf.json
.terraform.lock.hcl

# pgcopydb migration artifacts
migration_*/
filters.ini
*.log
core.*

# Editor
*.swp
*.swo
*~
.vscode/
.idea/
24 changes: 24 additions & 0 deletions pgcopydb-templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# pgcopydb Migration Instance Templates

Infrastructure-as-code templates for provisioning a migration instance pre-configured with [pgcopydb](https://github.com/planetscale/pgcopydb) and the [PlanetScale migration helper scripts](../pgcopydb-helpers/). Each template creates a compute instance running Ubuntu 24.04 that installs pgcopydb, PostgreSQL client tools, and the helper scripts at boot.

## Available Templates

| Template | Platform | Tool | README |
|----------|----------|------|--------|
| [AWS CloudFormation](./aws-cloudformation/) | AWS EC2 | CloudFormation | [README](./aws-cloudformation/README-pgcopydb-cfn.md) |
| [AWS Terraform](./aws-terraform/) | AWS EC2 | Terraform | [README](./aws-terraform/README-pgcopydb-aws-tf.md) |
| [GCP Terraform](./gcp-terraform/) | GCP Compute Engine | Terraform | [README](./gcp-terraform/README-pgcopydb-gcp.md) |

All three templates produce an equivalent migration instance — choose based on your cloud provider and preferred provisioning tool.

## What Gets Provisioned

- A compute instance with pgcopydb and PostgreSQL 17 client tools
- An attached data volume for migration working data
- Network and access configuration (security group/firewall rule, IAM/SSH via SSM or IAP)
- Migration helper scripts from this repo deployed to `/home/ubuntu/`

## After Provisioning

Once the instance is running, connect to it and follow the [migration workflow](../pgcopydb-helpers/README.md#migration-workflow) starting with setting up `~/.env` and `~/filters.ini`.
46 changes: 46 additions & 0 deletions pgcopydb-templates/aws-cloudformation/README-pgcopydb-cfn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# PlanetScale Migration — pgcopydb Migration Instance (AWS CloudFormation)

## What This Does

This CloudFormation template creates an EC2 instance pre-configured with
[pgcopydb](https://pgcopydb.readthedocs.io/), the tool PlanetScale uses to migrate
your PostgreSQL data. The instance runs Ubuntu 24.04 and pulls the latest
[PlanetScale migration helper scripts](https://github.com/planetscale/migration-scripts)
at boot.

## What Gets Created

- An EC2 instance with pgcopydb and PostgreSQL client tools installed
- An EBS volume for migration working data
- A security group for network access
- An IAM instance profile with SSM Session Manager access
- Migration helper scripts from `github.com/planetscale/migration-scripts` in `/home/ubuntu/`

## How to Deploy

### Prerequisites
- The IAM role from Step 1 must be deployed first
- VPC ID and a subnet ID where the instance should run
- The restored database from Step 3 must be accessible from this subnet
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, these prerequisites don't make any sense to me.


### Steps

1. **Upload** the `pgcopydb-migration-instance.yaml` template to CloudFormation
2. **Fill in** VPC ID, Subnet ID, instance type, and volume size
3. **Deploy** and wait for completion (~10 minutes)
4. **Connect** via SSM Session Manager (no SSH key needed):
```bash
aws ssm start-session --target INSTANCE_ID
```

## How to Tear Down

Delete the CloudFormation stack to remove the instance and all associated resources:

```bash
aws cloudformation delete-stack --stack-name YOUR_STACK_NAME
```

## Questions?

Contact your PlanetScale migration team representative.
Loading