Skip to content

Conversation

@sam-goodwin
Copy link
Contributor

Summary

  • Add EC2 Instance resources following the Lambda pattern for code bundling and deployment
  • Instance accepts a callback handler that gets bundled via esbuild and deployed to run on the instance
  • Automatic IAM role + instance profile creation with ec2.amazonaws.com trust policy
  • User data script bootstraps Amazon Linux 2023 with Node.js and systemd service management
  • Hybrid update strategy: code changes via SSM Run Command, infrastructure changes via replacement

New Files

File Purpose
instance.ts Instance Runtime definition and types (props, attrs, bindings)
instance.provider.ts Full provider implementation with lifecycle management
instance.process.ts Long-running process helper for background workers
instance.serve.ts HTTP server helper for web applications
instance.handler.ts Runtime utilities (toHandler, loadEnv, onShutdown)

Key Features

  • Same binding pattern as Lambda - env vars + IAM policy statements
  • Code bundling - Uses existing esbuild infrastructure
  • S3 storage - Code uploaded to alchemy assets bucket
  • SSM integration - Code updates deployed without instance replacement
  • systemd service - Process management with auto-restart

Test plan

  • Deploy a simple Instance.process worker
  • Deploy an Instance.serve HTTP server
  • Verify code updates via SSM work correctly
  • Verify instance termination cleans up all IAM resources
  • Verify bindings (S3, SQS, DynamoDB) work correctly

🤖 Generated with Claude Code

sam-goodwin and others added 2 commits January 11, 2026 17:26
Add EC2 Instance resources following the Lambda pattern where users
provide a callback handler that gets bundled and deployed to run on
the instance.

Key features:
- Instance runtime with props for VPC placement, instance type, AMI
- Automatic IAM role + instance profile creation
- Code bundling via esbuild and S3 upload
- User data script bootstraps Node.js + systemd service
- Hybrid updates: SSM for code changes, replacement for infrastructure
- Helper patterns: Instance.process, Instance.serve

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add integration test for EC2 Instance resources covering:
- VPC infrastructure setup (VPC, subnet, IGW, route table, security group)
- Instance creation with process handler
- Verification of instance attributes (instanceId, state, IPs, IAM resources)
- Instance termination and cleanup

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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