Skip to Content

PairSpaces

DocsBlog

PairSpaces

Cloud Spaces

Creating Cloud Spaces

You create Cloud Spaces using the PairSpaces CLI, a Space Key, and any cloud platform.

Creating Spaces Manually

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:

  1. Create a file at /etc/profile.d/pair.sh that exports PS_SPACE_KEY.

    export PS_SPACE_KEY=ps_live_7ATuLopVXIx_...
  2. Install the latest version of the PairSpaces CLI from https://get.pairspaces.io/install in /usr/local/bin.

  3. Create a Space.

    > pair spaces create

Creating Spaces Using Terraform

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

Previous

Keys

Next

Container