PantherX / Guix on Amazon AWS EC2 in ~ 15 minutes

We’ve recently had to migrate some 20 servers from DigitalOcean to AWS. Here are some important notes, and the script to take care of the installation.

  • We’ve tested this on the latest Debian AMI, but it should work on Ubuntu too
  • AWS disables root login by default and forces the use of admin
  • You can simply use DHCP. No need to manually configure IP’s

If you want to enable root login, simply modify the /root/.ssh/authorized_keys file. It looks like this initially:

no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"admin\" rather than the user \"root\".';echo;sleep 10;exit 142"

Simply remove this stuff, and / or replace with your public key.

Installation

  1. Create a new AWS EC2 VM (I used t2.large) with Debian AMI
  2. Login as admin and switch to root (sudo su - root)
  3. Copy the script into a setup.sh or whatever and run bash setup.sh

That’s it.

If you simply reboot, you won’t be able to login with root nor admin. Instead, use the password shown before reboot, and login as panther. Then switch to root with sudo su - root and enable root login (as explained before) - or not.

Here’s the script:

A quick follow-up on this. It’s important that you keep an eye on which instance type you launch, because they implement storage differently:

  • xvda on t2.*
  • nvme0n1 on t3.*

If you are spinning up a new VM, the t3.* should be significantly faster, with similar spec.

If you want to use another instance type, it’s usually enough to ensure the disk configuration matches the instance type you’re using. This should work for all AMD and Intel-based VM’s. I haven’t tried the new ARM type.

Here’s what this looks like for t2.*:

  (bootloader (bootloader-configuration
               (bootloader grub-bootloader)
               (target "/dev/xvda")))
       
  (file-systems (append
        (list (file-system
                (device "/dev/xvda1")
                (mount-point "/")
                (type "ext4")))
              %base-file-systems))

and for t3.*:

  (bootloader (bootloader-configuration
               (bootloader grub-bootloader)
               (target "/dev/nvme0n1")))
       
  (file-systems (append
        (list (file-system
                (device "/dev/nvme0n1p1")
                (mount-point "/")
                (type "ext4")))
              %base-file-systems))