> ## 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.

# Setup a Multipass CDK Environment
- URL: https://new-blog.dougals.me/setup-a-multipass-cdk-environment/
- Published: 2024-02-25T22:01:35.000Z
- Updated: 2024-02-25T22:01:35.000Z
- Author: Dougie Richardson
- Tags: Linux, Python, AWS, Coding, Ubuntu, #Migrated-1789219936886, #wp, #wp-post, #Import 2026-09-12 13:32

I want to be able to connect to the environment using Visual Studio Code, so first we need to create a SSH key:

```bash
ssh-keygen -t rsa
```

We need a configuration YAML, replace `<generated ssh-rsa key>` with the above key, saved as `cloud-init.yaml`:

```yaml
groups:
  - vscode
runcmd:
  - adduser ubuntu vscode
ssh_authorized_keys:
  - ssh-rsa <generated ssh-rsa key>
```

Assuming you've got Multipass installed (if not `sudo snap install multipass`) then:

```bash
multipass launch mantic --name ubuntu-cdk --cloud-init 
```

We'll come back to Visual Studio Code later but first lets set everything up in the VM. We need to install aws-cli which I want to use with SSO (hence why we installed Mantic).

```bash
multipass shell ubuntu-cdk
sudo apt install awscli
aws configure sso
```

Follow the prompts and sign in to AWS as usual. Then install CDK:

```bash
sudo apt install nodejs npm
sudo npm install -g aws-cdk
```

Almost there, lets bootstrap[1](https://new-blog.dougals.me/#61d4782e-c5c2-4dcb-ac45-f626dd0cff40) (provisioning resources needed to make deployments) substituting the relevant values:

```bash
cdk bootstrap aws://<account>/<region> --profile <profile>
```

You should see a screen like this:

![](https://blog.dougals.me/wp-content/uploads/2024/02/Screenshot-from-2024-02-25-21-47-20.png)

Create a new CDK application by creating a new folder, changing into it and initialising CDK:

```bash
cdk init app --language python
source .venv/bin/activate
python -m pip install -r requirements.txt
```

And that's about it, except for Visual Studio Code. You'll need to install [Microsoft's Remote-SSH extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remotMicrosoft%27s%20Remote-SSH%20extensione-ssh&ref=new-blog.dougals.me):

![](https://blog.dougals.me/wp-content/uploads/2024/02/Screenshot-from-2024-02-25-21-52-24.png)

You can get the IP address from `multipass list`, then in Code add a new SSH connection using `ubuntu@<ip>`:

![](https://blog.dougals.me/wp-content/uploads/2024/02/Screenshot-from-2024-02-25-21-57-28.png)

Accept the various options presented and you're there!

![VSCode](https://blog.dougals.me/wp-content/uploads/2024/02/Screenshot-from-2024-02-25-22-00-47.png)