-
-
Notifications
You must be signed in to change notification settings - Fork 605
Running OSv on EC2
These days EC2 instance types fall into two categories - old XEN-based like t2.*
and new KVM-based (aka "Nitro") like t3.*
. OSv can run on both XEN and KVM-based instances. OSv can not be deployed to ARM-based EC2 instances like Graviton.
The KVM-based Nitro EC2 instances require NVMe block device driver and ENA networking driver which OSv implements.
The old XEN-based EC2 has two modes of operation: Paravirtualization (PV), and Hardware-assisted Virtualization (HVM). PV is a work in progress, and actually quite exciting to work with but it currently cannot boot. You are welcome to help by Forking us on github.
Regardless of the EC2 type, the same OSv image can be deployed to both using the script deploy_to_aws.sh
like so:
./scripts/build fs=rofs image=golang-pie-httpserver,httpserver-monitoring-api fs_size_mb=128
./scripts/deploy_to_aws.sh vpc-xyz subnet-abc OSv-57-golang-http-api-rofs-kvm t3.nano #KVM/Nitro instance
./scripts/deploy_to_aws.sh vpc-xyz subnet-abc OSv-57-golang-http-api-rofs-xen t2.nano #XEN instance
The script uploads the latest built image as a snapshot, registers it as a new AMI, and creates a single EC2 instance using a simple cloud formation stack.
Finally, it waits for stack completion and prints the public DNS name of the created instance.
For small images like in the examples, the whole process takes less than 2-5 minutes (depending on connectivity speed to AWS).
Remote management of an OSv instance is done via OSV Rest API
OSv provides two management tools that utilize OSv Rest API:
- OSv Dashboard - access osv-ip:8000 with a browser
- OSv CLI - connect to a remote instance using cli
You can secure remote management of an instance by: configuring SSL via cloud init.
- Connecting to a secured OSv instance Dashboard requires additional browser configuration
- Connecting to a secured OSv via CLI over HTTPS requires additional params