Deploy an Ubuntu or Debian Google Cloud Platform server with user data and an enrollment token

This guide provides the information you need to deploy an Ubuntu or Debian Google Cloud Platform server with systemd using user data and an Advanced Server Access enrollment token. Depending on your target server and enrollment type some topics in this guide may not apply to you, such as if your team's project will not be using enrollment tokens or if you plan to add a different server type to your project. Modify your steps as needed to fit your team or refer to another cloud deployment guide.

Creating a cloud server with user data means that the Advanced Server Access agent is simultaneously installed when you create a server with a cloud provider. Using user data to install software on a new cloud server can be done through any cloud provider, although user data helps dictate the specific software that you want on your servers. Installing the Advanced Server Access agent on a cloud server doesn't have to be done when the cloud server is created, but running the installation as a startup script alongside a server's creation ensures that your cloud deployment is as safe and secure as possible.


You need the following to deploy a Google Cloud Platform server:

Google Cloud Platform

Requirement Description
Google Cloud Platform account A Google Cloud Platform account is needed to access the GCP console, where you create virtual machines for your team.

Advanced Server Access

Requirement Description
Advanced Server Access team This is the top-level object that is representing an organization within Advanced Server Access.
Advanced Server Access project This is the authorization-scope of your team, organizing your users, groups, and servers.

Create an Advanced Server Access enrollment token

  1. On the Advanced Server Access dashboard, click Projects.
  2. Select the project you want to add the server to.
  3. Select the Enrollment tab, then click Create Enrollment Token.

    Note: You can use the same enrollment token every time you add a server to your team. If you have already created an enrollment token, skip this step.

  4. Enter a description for the token, then click Submit.
  5. After the token has been successfully created, copy the string of characters from the Token field and store it in a safe location.

Create a Google Cloud Platform project

  1. Navigate to the Google Cloud Platform console and sign in to your account.
  2. Use the Select a project dropdown at the top of the page to click the New Project button.

  3. Create a new name for your project and use the Location field to set its parent organization or folder .
  4. Click Create when you've finished creating your project.
  5. From the dashboard of your new project, copy the Project ID number from the Project Info section and store it in a safe location.

    Note: To find your project's dashboard, use the Select a project box at the top of the console.

Create and enroll a virtual machine using user data

  1. From the Google Cloud Platform Console, select Compute Engine and then VM instances.
  2. If prompted, select your new project from the Select a project drop-down box.
  3. Click Create.
  4. Create a name for your new server and set its region and zone. These options determine where your server is located.
  5. Click Management, security, disks, networking, sole tenancy to expand it.
  6. Paste the following into the Startup Script text field:


    echo "Add an enrollment token"

    sudo mkdir -p /var/lib/sftd

    echo "<enrollment-token>" | sudo tee /var/lib/sftd/enrollment.token

    export DEBIAN_FRONTEND=noninteractive

    echo "Add a basic sftd configuration"

    sudo mkdir -p /etc/sft/

    sftcfg=$(cat <<EOF


    # CanonicalName: Specifies the name clients should use/see when connecting to this host.

    CanonicalName: "ubuntu-target"



    echo -e "$sftcfg" | sudo tee /etc/sft/sftd.yaml

    echo "Retrieve information about new packages"

    sudo apt-get update

    sudo apt-get install -y curl

    echo "Add the ScaleFT testing apt repo to your /etc/apt/sources.list system config file"

    echo "deb linux main" | sudo tee -a /etc/apt/sources.list

    echo "Trust the repository signing key"

    curl -C - | sudo apt-key add -

    echo "Retrieve information about new packages"

    sudo apt-get update

    echo "Install sftd"

    sudo apt-get install scaleft-server-tools

    Note: This script creates an sftd.yaml file for your server and uses ubuntu-target as its canonical name. Modify and generate this information as needed to fit your team and project environments.

  7. Replace <enrollment_token> in the user data field with the enrollment token that you created earlier.
  8. Click Create.

After your server is finished being created on the VM instances page, confirm that the server is listed in the Server tab of your Advanced Server Access project before you attempt to connect to it.

Next steps

Verify server enrollment