> ## Content Index
> Fetch the complete content index at: https://new-blog.dougals.me/llms.txt
> Use this file to discover other available public pages before exploring further.

# Multipass cloud-init
- URL: https://new-blog.dougals.me/multipass-cloud-init/
- Published: 2024-03-24T13:30:47.000Z
- Updated: 2024-03-24T13:30:47.000Z
- Author: Dougie Richardson
- Tags: Linux, AWS, CDK, Coding, Python, Ubuntu, #Migrated-1789219936886, #wp, #wp-post, #Import 2026-09-12 13:32

[Multipass](https://multipass.run/?ref=new-blog.dougals.me) 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](https://ubuntu.com/blog/using-cloud-init-with-multipass?ref=new-blog.dougals.me) scripts as a parameter. I wanted an Ubuntu LTS instance with AWS CDK, which needs `Node.js` and `python3-venv`.

```yaml
#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:

```bash
multipass launch --name cdk --cloud-init cdk.yaml
```

![Success!](https://blog.dougals.me/wp-content/uploads/2024/03/Screenshot-from-2024-03-24-12-44-52-e1711284497926.png)

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.

```bash
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:

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