A research document detailing approaches to run Development Containers remotely on AWS and GCP, plus Kubernetes/EKS-based ephemeral workspaces.
- Introduction
- AWS EC2-Based DevContainer Workspaces
- GCP Compute Engine VM Workspaces
- Feature Comparison & Trade‑offs
- Best Practices
- Recommendations & Next Steps
- AWS EKS Ephemeral DevContainer Workspaces
- DevContainers: Open specification for container-based development environments.
Spec reference: https://containers.dev/spec/ - Why cloud?
- On‑demand compute resources
- Consistent environments
- Team collaboration and resource sharing
graph LR
IDE[VS Code IDE]
EC2[EC2 Instance]
IDE -->|Remote SSH| EC2
EC2 -->|Docker| DevContainer
DevContainer -->|Git Clone| CodeRepo[(GitHub repo)]
EC2 -->|VPC| Internet[(Internet)]
- AWS CLI &
aws configure
(https://docs.aws.amazon.com/cli/) - IAM Role with:
- EC2:
AmazonEC2FullAccess
- SSM:
AmazonSSMManagedInstanceCore
- ECR:
AmazonEC2ContainerRegistryReadOnly
- EC2:
- Launch EC2 (Amazon Linux 2) AMI.
- Provide user data to install Docker & VS Code Server.
- Configure Security Group:
- SSH (22)
- HTTPS (443) if using code server TLS
- Connect via Remote SSH in VS Code.
- VPC subnet (public IP) or private IP + NAT
- Bastion host pattern for secure access
- Security Groups & NACLs
- AWS Instance Scheduler solution:
https://aws.amazon.com/solutions/instance-scheduler/ - Lambda or SSM Automation to shut down idle instances
- Session Manager: Avoid opening SSH port
- Patch Management: AWS SSM Patch Manager
- Encryption: EBS volumes with KMS
graph LR
IDE[VS Code IDE]
GCE[Compute Engine VM]
IDE -->|Remote SSH| GCE
GCE -->|Docker| DevContainer
DevContainer -->|Cloud Storage| GCS[(GCS bucket)]
GCE -->|VPC| Internet[(Internet)]
- Google Cloud SDK &
gcloud auth login
- Service Account with:
- Compute Admin
- Storage Admin
gcloud compute instances create <name> \
--metadata-from-file startup-script=startup.sh
- Firewall rules: allow TCP 22 (SSH)
- Use
gcsfuse
to mount buckets if needed
- VPC network & subnet configuration
- Cloud NAT for outbound
- Private Google Access for APIs
- Preemptible VMs or auto‑stop on idle:
https://cloud.google.com/compute/docs/instances/preemptible
- OS Login for SSH via IAM
- Shielded VM
- VPC Service Controls
- Disk encryption with CMEK
Criterion | AWS EC2 | GCP VM | AWS EKS Ephemeral |
---|---|---|---|
Startup Time | ~1–2 min | ~1–2 min | ~30–60 sec |
Cost Model | $/hour + EBS | $/hour + PD | Pod-based |
Networking | VPC/Security Groups | VPC/Firewall Rules | Kubernetes CNI |
IAM Integration | AWS IAM roles | GCP Service Accounts | IRSA + K8s RBAC |
Auto‑shutdown | Scheduler/Lambda | Preemptible/Auto‑stop | Pod TTL |
- Container Registry: Use private ECR/GCR
- Image Caching: Layered Docker builds
- Least‑Privilege IAM
- Shutdown Policies: Tag resources & enforce TTL
- Pilot: AWS EC2 approach for initial rollout
- Metrics:
- Cold start vs. warm start time
- Cost per user‑hour
- Security audit outcomes
- Documentation: Onboarding playbook
graph LR
IDE[VS Code IDE]
EKS[EKS Cluster]
IDE -->|Remote Kubernetes| EKS
subgraph Namespace “workspace”
Pod[Ephemeral Pod<br>(DevContainer image)]
PVC[Ephemeral PVC]
Pod -->|Mount| PVC
end
Pod -->|Git Clone| CodeRepo[(GitHub Repo)]
EKS -->|Ingress/ALB| Internet
- Provision EKS via
eksctl
or Terraform - IAM Role for ServiceAccount with:
- ECR access
- SSM for session audit
- SecretsManager
apiVersion: workspace.devfile.io/v1
kind: DevWorkspace
metadata:
name: dev-${USER}
namespace: ${USER}
spec:
template:
components:
- container:
name: tools
image: myregistry/devcontainer:latest
mountSources: true
env:
- name: NODE_ENV
value: development
endpoints:
- name: vscode
targetPort: 8443
exposure: public
- volume:
name: workspace-storage
size: 5Gi
commands:
- id: init-project
exec:
component: tools
commandLine: npm install
- metadata.name/namespace: unique per user
- template.components.container: image, mounts, env, endpoints
- volume: ephemeral storage
- commands: init, build, test steps
- Deploy DevWorkspace Operator:
kubectl apply -f https://github.com/devfile/devworkspace-operator/releases/latest/download/install.yaml
- Create namespace per user
- Apply
DevWorkspace
CR instance (see above) - VS Code: Remote – Kubernetes attach via endpoint
- AWS VPC CNI plugin for pod networking
- ALB Ingress Controller + TLS certificate
NetworkPolicy
per namespace
- Cluster Autoscaler on node groups or Fargate
Pod
TTL Controller to delete idle workspaces
- Kubernetes RBAC scoped to namespaces
- Pod Security Standards (no privileged)
- Image signature verification (Cosign)
- Encrypted PVC via AWS KMS (EBS CSI driver)