Skip to content

Phase 1: complete runtime & dependency upgrade (aws-sdk v2 → v3, ncc modernization) #7

@kurok

Description

@kurok

Part of plan #15. Phase 1 — Runtime & Dependency Upgrade.

What's already done

  • #3actions/runner bumped v2.321.0 → v2.333.1 (bundles externals/node24).
  • #4action.yml moved using: node12using: node24.
  • #5 — outputs written to $GITHUB_OUTPUT instead of ::set-output.
  • #6DEP0169 (url.parse) deprecation filtered via process.emitWarning override.
  • #3verify-dist CI guard prevents stale bundles.

What's left

Migrate aws-sdk v2 → AWS SDK v3 (@aws-sdk/client-ec2).

v2 is in maintenance mode (AWS announced end-of-support Nov 2025) and emits DEP0169 even at latest v2.1693. v3 uses WHATWG URL, per-service packages (smaller bundle), and a modern API surface.

Refactor targets:

  • src/aws.js — replace new AWS.EC2() with new EC2Client({region}) and command-based send(new RunInstancesCommand({...})) pattern.
  • package.json — drop aws-sdk, add @aws-sdk/client-ec2.
  • dist/index.js — rebuild. Bundle will shrink significantly (v3 is per-service).

Note on @vercel/ncc: the pinned ncc 0.25.1 is webpack-4-era and refuses to parse modern-JS transitive deps (private class fields). Any real dependency modernization (aws-sdk v3, @actions/core ≥ 1.10, etc.) requires bumping @vercel/ncc to ^0.38.x at the same time. This is the build-side prerequisite for every other dep upgrade.

Compatibility with consumers

External contract must be preserved:

  • Inputs: mode, github-token, ec2-image-*, ec2-instance-type, subnet-id, security-group-id, eip-allocation-id, iam-role-name, aws-resource-tags — all stay the same.
  • Outputs: label, ec2-instance-id — stay the same.

Verify via a dogfood push from terraform-provider-namecheap before merging — rotate the SHA pin in that repo's ci.yml on a throwaway branch and confirm the acceptance test pipeline still lifts an EC2, registers a runner, runs make testacc, and terminates cleanly.

Acceptance criteria

  • aws-sdk removed from package.json; @aws-sdk/client-ec2 added.
  • src/aws.js uses EC2Client + Command pattern.
  • @vercel/ncc bumped to ^0.38.x (webpack 5 — can parse modern syntax).
  • dist/index.js rebuilt cleanly; verify-dist CI green.
  • No action-level deprecation warnings on a fresh run.
  • Dogfood test on terraform-provider-namecheap acctest passes end-to-end.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions