Multipass cloud-init

Multipass is pretty useful but what a pain this was to figure out, due to Ubuntu’s Node.js package not working with AWS-CDK.

Multipass lets you manage VM in Ubuntu and can take cloud-init scripts as a parameter. I wanted an Ubuntu LTS instance with AWS CDK, which needs Node.js and python3-venv.

#cloud-config
packages:
  - python3-venv
  - unzip

package_update: true

package_upgrade: true

write_files:
  - path: "/etc/environment"
    append: true
    content: |
      export PATH=\
      /opt/node-v20.11.1-linux-x64/bin:\
      /usr/local/sbin:/usr/local/bin:\
      /usr/sbin:/usr/bin:/sbin:/bin:\
      /usr/games:/usr/local/games:\
      /snap/bin

runcmd:
  - wget https://nodejs.org/dist/v20.11.1/node-v20.11.1-linux-x64.tar.xz 
  - tar xvf node-v20.11.1-linux-x64.tar.xz -C /opt
  - export PATH=/opt/node-v20.11.1-linux-x64/bin:$PATH
  - npm install -g npm@latest
  - npm install -g aws-cdk
  - git config --system user.name "Dougie Richardson"
  - git config --system user.email "xx@xxxxxxxxx.com"
  - git config --system init.defaultBranch main
  - wget https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
  - unzip awscli-exe-linux-x86_64.zip
  - ./aws/install

Save that as cdk.yaml and spin up an new instance:

multipass launch --name cdk --cloud-init cdk.yaml
Success!

There’s a couple useful things to note if you’re checking this out:

  • Inside the VM there’s a useful log to assist debugging /var/log/cloud-init-output.log.
  • While YAML has lots of ways to split text over multiple lines, when you don’t want space use a backslash.

Shell into the new VM with multipass shell cdk, then we can configure programmatic access and bootstrap CDK.

aws sso configure
aws sso login --profile profile_name
aws sts get-caller-identity --profile profile_name
aws configure get region --profile profile_name

The last two commands give the account and region to bootstrap:

cdk bootstrap aws://account_number/region --profile profile_name

The Psychology of Money

The Psychology of Money

The Psychology of Money by Morgan Housel is a captivating exploration of financial decision-making through the lenses of history and psychology. Here are five takeaways from the book:

  • Financial Success Is Not About Formal Education or High Income: Housel contrasts two individuals: Ronald Read, an uneducated janitor who invested wisely and left millions in his will, and Richard Fuscone, a finance professional who lost everything due to overspending during the 2008 financial crisis. The lesson? Financial success depends more on **soft skills**—how we manage our psychology and emotions—than technical financial expertise.
  • Understanding Our Biases and Emotions: Our backgrounds and childhood experiences shape our perception of money, risk, and financial management. Recognising our biases and emotional impulses is crucial for making rational decisions about money.
  • Long-Term Thinking and Patience: Housel recommends holding long-term diversified stock portfolios and allowing them to compound over time. Patience pays off; avoid chasing short-term gains and focus on the big picture.
  • Ego and Humility in Finance: Ego-driven spending on status symbols can hinder financial success. Humility and a wary attitude toward the future are essential for making sound financial choices.
  • Margin for Error and Saving for the Future: Always operate with a margin for error—unexpected events happen. Save consistently for the future, even if it’s a small amount. Compound interest works wonders over time.

The Psychology of Money emphasises that financial well-being is not just about numbers; it’s about understanding ourselves, managing emotions, and making thoughtful choices.