Creating Cloud Spaces
You create Cloud Spaces using the PairSpaces CLI, a Space Key, and any cloud platform.
We recommend using infrastructure-as-code tools like AWS CDK or Terraform to configure your virtual machines as Spaces.
To use a manual approach instead, follow these steps:
Create a file at /etc/profile.d/pair.sh that exports PS_SPACE_KEY.
export PS_SPACE_KEY=ps_live_7ATuLopVXIx_...
Install the latest version of the PairSpaces CLI from https://get.pairspaces.io/install in /usr/local/bin.
Create a Space.
> pair spaces create
Create Terraform files that create an AWS EC2 instance that uses user-data to install and configure the PairSpaces CLI.
variable "ps_space_key" {
type = string
sensitive = true
}
locals {
cloud_init = templatefile("${path.module}/cloud-init.yaml.tftpl", {
ps_space_key = var.ps_space_key
})
}
resource "aws_instance" "this" {
ami = ...
instance_type = ...
...
user_data = local.cloud_init
}
This is the YAML definition of cloud-init user data:
#cloud-config
write_files:
- path: /etc/systemd/system/pair.service
owner: root:root
permissions: '0644'
content: |
[Unit]
Description=Creates a Space
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
Environment=PS_SPACE_KEY=${ps_space_key}
ExecStart=/usr/local/bin/pair spaces create
Restart=always
RestartSec=10
KillSignal=SIGTERM
[Install]
WantedBy=multi-user.target
runcmd:
- curl -fsSL https://get.pairspaces.io/install | sh -s -- -b /usr/local/bin
- systemctl daemon-reload
- systemctl enable --now pair.service