Skip to content

feat(aws): add --create-vpc option to provision a dedicated VPC#360

Merged
PierreBeucher merged 3 commits into
PierreBeucher:masterfrom
alexjurkiewicz:feat/aws-create-vpc
Apr 12, 2026
Merged

feat(aws): add --create-vpc option to provision a dedicated VPC#360
PierreBeucher merged 3 commits into
PierreBeucher:masterfrom
alexjurkiewicz:feat/aws-create-vpc

Conversation

@alexjurkiewicz
Copy link
Copy Markdown
Contributor

@alexjurkiewicz alexjurkiewicz commented Apr 3, 2026

Summary

  • Adds a --create-vpc flag and matching interactive wizard prompt that provisions a full public networking stack alongside the EC2 instance
  • Creates one public subnet per availability zone so spot instances can be scheduled in whichever AZ has capacity
  • IPv6 is enabled on the VPC and all subnets, giving the instance a routable IPv6 address
  • The createVpc setting is persisted in instance state and passed through to Pulumi on every subsequent provision, so the VPC lifecycle is fully managed with the instance

Resources created

  • VPC (10.0.0.0/16, DNS enabled, Amazon-provided /56 IPv6 CIDR)
  • Internet Gateway
  • One public subnet per AZ (10.0.N.0/24 + /64 IPv6 CIDR carved from the VPC block, mapPublicIpOnLaunch enabled)
  • Route table with default IPv4 (0.0.0.0/0) and IPv6 (::/0) routes to the IGW, associated to every subnet

If --zone is specified the instance uses that AZ's subnet; otherwise the first available subnet is used.

Test plan

  • cloudypad create aws --create-vpc completes successfully in an account with no default VPC
  • cloudypad create aws (without --create-vpc) continues to work as before
  • cloudypad destroy <name> tears down the VPC and all subnets cleanly
  • Spot instance with --create-vpc and no --zone launches successfully

🤖 Generated with Claude Code

@alexjurkiewicz
Copy link
Copy Markdown
Contributor Author

Test coverage note

The following test files will need updates to cover the new AWS fields introduced across this batch of PRs (#360, #362):

  • test/unit/providers/aws/cli.spec.ts
  • test/unit/providers/aws/state.spec.ts
  • test/integ/unstable/pulumi/test-config.spec.ts

Since multiple PRs in this batch touch the same files, would you prefer each PR adds its own test updates, or a single follow-up PR updating all tests after these land? Happy to implement whichever approach you prefer.

@PierreBeucher
Copy link
Copy Markdown
Owner

This loos like a nice addition well done, AI made a few mistakes that it should be able to fix with my comments.

Also make sure to test use case without additional VPC please as stated in checklist ;)

Comment thread src/providers/aws/state.ts Outdated
Comment thread src/providers/aws/cli.ts Outdated
Comment thread src/providers/aws/provisioner.ts Outdated
Comment thread src/providers/aws/cli.ts Outdated
Comment thread src/providers/aws/cli.ts Outdated
Comment thread src/providers/aws/cli.ts Outdated
Comment thread src/providers/aws/pulumi/main.ts Outdated
Comment thread src/providers/aws/pulumi/main.ts Outdated
Comment thread src/providers/aws/pulumi/main.ts Outdated
Comment thread src/providers/aws/pulumi/main.ts Outdated
alexjurkiewicz and others added 3 commits April 5, 2026 07:06
Add a --create-vpc flag (and matching interactive wizard prompt) that
creates a full public networking stack before the EC2 instance:

- VPC (10.0.0.0/16, DNS enabled)
- Internet Gateway
- One public subnet per availability zone (10.0.N.0/24), each with
  mapPublicIpOnLaunch enabled, so spot instances can be scheduled in
  whichever AZ has capacity
- Route table with a default route to the IGW, associated to every subnet

If --zone is specified the instance uses that AZ's subnet; otherwise the
first available subnet is used and AWS picks the AZ.

The createVpc flag is persisted in instance state and passed through to
Pulumi on every subsequent provision so the VPC lifecycle is fully
managed alongside the instance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Assign an Amazon-provided IPv6 /56 block to the VPC and carve a /64 per
subnet. Add a ::/0 route to the IGW so instances get a routable IPv6
address without any extra configuration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ract CloudyPadVpc component, fix AZ stability

- Rename createVpc (boolean) -> dedicatedVpc ({ enabled: boolean }) for extensibility (future cidr/IPv6 options)
- Extract VPC creation into a CloudyPadVpc ComponentResource to encapsulate networking concerns
- Fix AZ stability: use {region}a instead of subnets[0] so repeated Pulumi runs always target the same AZ, keeping EBS volumes and instances co-located
- CLI flag renamed --create-vpc -> --dedicated-vpc

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@PierreBeucher
Copy link
Copy Markdown
Owner

LGTM, thanks ! I'll do a quick test on the branch and then merge it

@PierreBeucher PierreBeucher merged commit c39428e into PierreBeucher:master Apr 12, 2026
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.

2 participants