AWS Routing Policies - Visual Comparison

AWS

A quick explanation and visual overview of the AWS Route 53 policies (with the exception of Geoproximity Routing).

Simple Routing Policy

Use for a single resource that performs a given function for your domain, for example, a web server that serves content for the example.com website.

Important points to remember:

  • Simplest routing policy
  • Only one DNS record set
  • Multiple IP address per record set can be used
  • Values are returned to user in random order
  • No health checks

Weighted Routing Policy

Weighted Routing Policy controls the percentage of the requests that go to a specific endpoint.

Important points to remember:

  • Weighted routing sends user traffic based on the weight that you supply
  • You can split traffic between different regions
  • Multiple IP address per record set can be used
  • Health checks can be used

Latency Routing Policy

Use when you have resources in multiple AWS Regions and you want to route traffic to the region that provides the best latency.

Important points to remember:

  • Routing will be based on user to region latency
  • Multiple IP address per record set can be used
  • Health checks can be used

Failover Routing Policy

Use failover routing policy when you want to configure active-passive failover.

Important points to remember:

  • Use failover routing policy when you want to configure active-passive failover
  • Health checks
    • You can’t save the primary record without a health check
    • The secondary record can be created without a health check

Geolocation Routing Policy

Geolocation routing lets you choose the resources that serve your traffic based on the geographic location of your users, meaning the location that DNS queries originate from.

Important points to remember:

  • This is routing based on user’s location
  • Multiple IP address per record set can be used
  • Health checks can be used

Multivalue Answer Routing policy

Use when you want Route 53 to respond to DNS queries with up to eight healthy records selected at random.

Important points to remember:

  • It’s very similar to simple routing, but with two differences:
    • You can have multiple record sets
    • You can have health checks

How to Change macOS Key Bindings

macOS VirtualBox

This post will show you how to change line movement and control key bindings in macOS to be similar to what we use in Linux (and windows).

The following keyboard shortcuts will be added:

Sequence Command
Ctrl+Left Back one word
Ctrl+Right Forward one word
Ctrl+Shift+Left Back one word and modify selection
Ctrl+Shift+Right Forward one word and modify selection
Home Beginning of the line
End End of line
Shift+Home Beginning of the line and modify selection
Shift+End End of line and modify selection
Ctrl+Home Top of page
Ctrl+End End of page
Shift+Ctrl+Home Top of page and modify selection
Shift+Ctrl+End End of page and modify selection

Instructions

a. First create the folder ~/Library/KeyBindings/ and then the file DefaultKeyBinding.Dict

mkdir ~/Library/KeyBindings/
vim DefaultKeyBinding.Dict

b. Add the contents below to the new file:

{
    /* Ctrl + Left */
    /* "^\UF702"  = "moveWordLeft:"; */
    "@\UF702"  = "moveWordLeft:";

    /* Ctrl + Right */
    /* "^\UF703"  = "moveWordRight:"; */
    "@\UF703"  = "moveWordRight:";

    /* Ctrl + Shift + Left */
    /* "^$\UF702" = "moveWordLeftAndModifySelection:";*/
    "@$\UF702" = "moveWordLeftAndModifySelection:";

    /* Ctrl + Shift + Right */
    /* "^$\UF703" = "moveWordRightAndModifySelection:";*/
    "@$\UF703" = "moveWordRightAndModifySelection:";

    /* Remap Home / End keys */
    /* Home Button*/
    "\UF729" = "moveToBeginningOfLine:";
    /* End Button */
    "\UF72B" = "moveToEndOfLine:";

    /* Shift + Home Button */
    "$\UF729" = "moveToBeginningOfLineAndModifySelection:";

    /* Shift + End Button */
    "$\UF72B" = "moveToEndOfLineAndModifySelection:";

    /* Ctrl + Home Button */
    /* "^\UF729" = "moveToBeginningOfDocument:"; */
    "@\UF729" = "moveToBeginningOfDocument:";

    /* Ctrl + End Button */
    /* "^\UF72B" = "moveToEndOfDocument:"; */
    "@\UF72B" = "moveToEndOfDocument:";

    /* Shift + Ctrl + Home Button */
    /* "$^\UF729" = "moveToBeginningOfDocumentAndModifySelection:"; */
    "$@\UF729" = "moveToBeginningOfDocumentAndModifySelection:";

    /* Shift + Ctrl + End Button*/
    /* "$^\UF72B" = "moveToEndOfDocumentAndModifySelection:"; */
    "$@\UF72B" = "moveToEndOfDocumentAndModifySelection:";
}

Note: The code above assumes you are have substituted the Command Key for the Control Key in «Keyboard => Modifier Keys…» (see screenshot below). If you haven’t, you can try changing the comment between the commented and uncommented blocks.

c. Restart the application you want to use


Reference:

How to Share WiFi Credentials from Terminal

Bash Linux Networking

Now here’s a cool and quick way to share your WiFi SSID and password from a terminal window with a guest.

You can use qrencode to generate a QR code with the parameters below:

WIFI:S:[Your SSID here];T:WPA;P:[Your Password Here];;

For example, let’s pretend my SSID is MySweetSSID and my password is mysecretpassword. We can run:

qrencode -o - -t utf8 'WIFI:S:MySweetSSID;T:WPA;P:mysecretpassword;;'

To get:

How to Install macOS Catalina in Virtual Box

Linux VirtualBox macOS

This document will provide instructions on getting a macOS Catalina install working with Guest Additions on VirtaulBox 6.1.

Start by downloading a copy of the installer from the App Store. You will need a computer running macOS and you will need to convert the installer to an ISO. I will not be covering these steps here, but there are plenty tutorials online.

Installing VirtualBox

I’m hoping you already have this part covered and you are coming here only because you had issues getting macOS installed, but just in case, make sure the following packages are installed (Arch):

$ pac list virtualbox
local/virtualbox 6.1.6-1
    Powerful x86 virtualization for enterprise as well as home use
local/virtualbox-ext-oracle 6.1.6-1
    Oracle VM VirtualBox Extension Pack
local/virtualbox-guest-iso 6.1.6-1
    The official VirtualBox Guest Additions ISO image
local/virtualbox-host-modules-arch 6.1.6-1
    Virtualbox host kernel modules for Arch Kernel

Creating the VM

Start by creating a new VM. Give it a name without spaces.

Give it enough memory so the install will run faster. We can change this later.

Select to create a new Virtual Hard Disk

Select VDI

Select fixed size

Give it a bare minimum of 25GB (I would advise on at least 50GB if you can spare the space)

Edit the machine, go into «System => Motherboard» and disable floppy boot and change the chipset to PIIX3

In the processor give more CPU if you can spare

In «Display => Screen» increase the video memory to 128MB and enable 3D acceleration

Enable USB 3.0

Note: if you can’t see USB 3.0 you might need to add your user to the vboxusers group

Insert the install ISO

Additional Configuration

Now we need to run a few vboxmanage commands for additional settings. Either run the lines with vboxmanage from the script below (add your virtual machine name under $vm_name), or save the full script and run it.

Note: the default resolution is set to «1280x1024». You can change it in the last line of the update code. Make sure to keep it to “640x480, 800x600, 1280x1024, 1440x900, 1900x1200“

#!/bin/bash

PS3='Please select the VM: '
n=0
while read line ; do
  options[n++]="$line"
done <<<"$(vboxmanage list vms | awk '{$NF=""; print $0}' | tr -d '"')"
select opt in "${options[@]}" ; do
  vm_name="$opt"
  break
done

echo "Running updates for \"${vm_name}\" VM"

vboxmanage modifyvm "$vm_name" --cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbff && echo "Changed CPU ID Set" ; sleep .5
vboxmanage setextradata "$vm_name" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3" && echo "Changed DmiSystemProduct" ; sleep .5
vboxmanage setextradata "$vm_name" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0" && echo "Changed DmiSystemVersion" ; sleep .5
vboxmanage setextradata "$vm_name" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple" && echo "Changed DmiBoardProduct" ; sleep .5
vboxmanage setextradata "$vm_name" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" && echo "Changed DeviceKey" ; sleep .5
vboxmanage setextradata "$vm_name" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1 && echo "Changed GetKeyFromRealSMC" ; sleep .5
vboxmanage setextradata "$vm_name" "VBoxInternal2/EfiGraphicsResolution" "1920x1080" && echo "Changed resolution to 1280x1024" ; sleep .5

Installing macOS

We are now ready for the install. Start the machine and select you language.

Select disk utility.

Select the VirtualBox hard disk and click on erase.

Give it a name, select the same options and click on erase. Close the disk utility when done.

Click on install macOS.

Continue with the install as you would until you are presented with the desktop.

Note that the installer will reboot once in the middle of the install.

Installing Guest Additions

We now need to get Guest Additions installed. Remove the install ISO and mount the guest additions CD. Open it with finder and run the VBoxDarwinAdditions.pkg

Install it as if you would install any other package.

You will most likely get an error message that the install has failed.

Close everything, unmount the guest additions CD and open a terminal window (Command+Space, type terminal).

Now we need to restart the VM in recovery mode. Type in:

sudo nvram "recovery-boot-mode=unused"
sudo reboot

Once it has rebooted into recovery mode, on the top click on «Utilities => Termminal»

Type in the code below. This is to sign Oracle software as authorized. Then we disable recovery mode and restart the VM.

spctl kext-consent add VB5E2TV963
nvram -d recovery-boot-mode
reboot

When the VM has rebooted you should have guest additions working. Remember that not everything works, but the features below should:

  • Copy/Paste
  • ~Drag and Drop~ Reported as not working (see comments)
  • VirtualBox Shared Folders
  • Guest Control

How to Install chrome-remote-desktop on Arch

Linux Arch

Chrome Remote Desktop has been around for quite a while, but now Google offers a .deb installer with native Linux support via Systemd. This is great because it removes the need to setup VPNs and VNC to remote connect to your machines, or in the case that you need to land a hand to a not so technical savvy family member or friend.

Unfortunately the installer is only for Ubuntu (and Debian based distros), but with a few steps we can get it running on Arch, and (thanks to a patch by nightuser) even configure it to use existing X sessions instead of creating a new one (which is the default behavior).

As expected, the packages exists in the AUR, so the install should be pretty simple.

Instructions

Install

a. Install chrome-remote-desktop from the AUR

b. Run crd --setup to configure your connection. Hit any key

c. Select your Desktop Environment (I selected KDE which is what I use) and save the file

d. Press any key again

e. Enter a new resolution if you would like to use something different than the default (1366x768). Save the file

f. You should see the confirmation that the setup is complete

g. Go to https://remotedesktop.google.com/headless and click on ‘Begin’

h. Click on ‘Next’

i. Click on ‘Authorize’

j. Select the Goole account you would like to use

k. Give it permission

l. Click on the copy the button and paste it on your terminal

m. Give the computer a friendly name and a pin to access it

You should get a confirmation that everything went ok

Starting Xvfb on display :20
X server is active.
Launching X session: ['/bin/sh', '/home/victor/.chrome-remote-desktop-session']
Launching host process
['/opt/google/chrome-remote-desktop/chrome-remote-desktop-host', '--host-config=-', '--audio-pipe-name=/home/victor/.config/chrome-remote-desktop/pulseaudio#ae6329c099/fifo_output', '--server-supports-exact-resize', '--ssh-auth-sockname=/tmp/chromoting.victor.ssh_auth_sock', '--signal-parent']
wait() returned (1092272,0)
Host ready to receive connections.
Log file: /tmp/chrome_remote_desktop

Additional Configuration

The additional configuration will allow you to connect to an existing session instead of creating a new one when connecting.

a. Find what display number X is using

$ echo $DISPLAY
:0

b. Create a file in ~/.config/chrome-remote-desktop/Xsession with the display value

$ echo "0" > ~/.config/chrome-remote-desktop/Xsession

c. Stop the chrome-remote-desktop.service

$ systemctl --user stop chrome-remote-desktop.service

d. Check if it stopped with crd --status. If it did not, stop it with crd --stop

$ crd --status
CRD status: STOPPED

e. Take a backup of /opt/google/chrome-remote-desktop/chrome-remote-desktop

f. Download the patched /opt/google/chrome-remote-desktop/chrome-remote-desktop to the same location, or follow the instructions to manually modify your file here.

Note: The patched version was tested with chrome-remote-desktop 81.0.4044.60-1

g. Start the agent with crd --start so you can see verbose output. You should receive a confirmation when it starts

$ crd --start

Launching X server and X session.
Using existing Xorg session: 0
Launching host process
['/opt/google/chrome-remote-desktop/chrome-remote-desktop-host', '--host-config=-', '--audio-pipe-name=/home/victor/.config/chrome-remote-desktop/pulseaudio#ae6329c099/fifo_output', '--ssh-auth-sockname=/tmp/chromoting.victor.ssh_auth_sock', '--signal-parent']
Host ready to receive connections.
Log file: /tmp/chrome_remote_desktop_20200402_202207_2vtQSb

h. Go to https://remotedesktop.google.com/ from another computer and try to access your computer

code with