Skip to content

Instantly share code, notes, and snippets.

View nanderson94's full-sized avatar
👾

Nic Anderson nanderson94

👾
View GitHub Profile

The launch template requests Spot instances with at least 1 vCPU and 1GiB of memory up to 4x that. This will often select the "best value" instances which are capable of running the work, but not wasteful.

The cloud-config is embedded within the launch template, base64 encoded, sets up K3s, and applies my manifest (my user-name is embedded, so you probably want to replace https://cdn.n0t.dev/public/aws-spot.yaml with something of your own). Additionally, it installs stern which is just a handy way to get logs out of the cluster.

You'll need to do the AWS basics such as creating a keypair and configuring your security group to allow SSH in order to access your instance. But once on it, you can:

Login to your instance:

chmod 0600 ~/your-aws-key.pem
ssh -i ~/your-aws-key.pem ubuntu@127.0.0.1
/* Pls forgive spaghetti code */
@import url("https://fpapi.nanderson.me/dejavusans/dejavusans_book_macroman/stylesheet.css");
@import url("https://fpapi.nanderson.me/dejavusansmono/dejavusansmono_book_macroman/stylesheet.css");
#content-wrapper, body {
background:#073642;
/*color:#93a1a1; */
color:#839496;
font-family: 'dejavu_sansbook';
}
#!/bin/bash
# Set up with a cron job to regularly check the CPU temperatures
# */5 * * * * /path/to/script.sh
# Alternatively, systemd timer
# [Unit]
# Description=Temperature monitor timer
#
# [Timer]
# OnUnitActiveSec=5m

Keybase proof

I hereby claim:

  • I am nanderson94 on github.
  • I am nander (https://keybase.io/nander) on keybase.
  • I have a public key ASC-MElwfgP_hGhYGnfq-u3OCELEbV5CPvzfdFwppwMfKAo

To claim this, I am signing this object: