How-To: Add EZSSH Access to Endpoints With Cloud Init

Learn how to add your EZSSH SSH Certificate Authority to new Azure and AWS virtual machines with cloud-init, the easiest way to enable passwordless SSH on cloud resources.

Overview - How to Enable SSH Certificate Authentication With cloud-init

EZSSH uses SSH certificates to authenticate to your endpoints. Since SSH certificates are a native OpenSSH feature, no custom code has to run on your endpoints. Once an endpoint has your EZSSH policy’s CA in its TrustedUserCAKeys, it works with EZSSH.

This guide shows you how to do this with cloud-init, which runs the setup the first time a new VM boots. You might also be interested in:

Prerequisites for Adding EZSSH Access With cloud-init

  1. You have created at least one EZSSH policy.

Step-by-Step Guide - How to Add EZSSH Access to a New VM With cloud-init

Step 1: How to Download the cloud-init File From EZSSH

Every EZSSH policy has its own SSH Certificate Authority (CA). The setup script for a policy adds that CA, and the policy’s Linux principals, to your endpoint.

  1. Go to the EZSSH portal.

  2. From the left-hand menu, select Hybrid Policies or Azure Policies, depending on the type of policy you want to set up.

  3. Expand the policy you want to set up. In this example, we expand “AWS EastUS Policy”.

    EZSSH Agentless JIT Access Hybrid Policies page with expand button highlighted on a policy
  4. Click Get Script at the top of the policy.

    EZSSH Agentless JIT Access expanded hybrid policy with Get Script button highlighted

Once the Setup Script dialog is open, download the cloud-init file:

  1. Stay on the Cloud Init tab.

  2. Under Select your Linux Distro, select the distribution your endpoints run (CentOS, Debian, RedHat, or Ubuntu).

    EZSSH Agentless JIT Access Setup Script dialog with Linux distro selection dropdown highlighted
  3. Click Download.

    EZSSH Agentless JIT Access Setup Script dialog with Download button highlighted
  4. Your browser saves the cloud-init file to your downloads folder as <policy name>.yaml.

Step 2: How to Add the cloud-init File to Your New VM

Every major cloud accepts a cloud-init file when you create a VM. Select your cloud below:

How to Add the EZSSH cloud-init File to an Azure VM

  1. Sign in to the Azure Portal.

  2. Click Create a resource.

    Azure portal home showing Create a resource button highlighted
  3. Select the resource type. In this example, we create an Ubuntu server.

    Azure New resource panel with Ubuntu Server 18.04 LTS highlighted
  4. Fill in the Basics, Disks, Networking, and Management tabs with your preferences, clicking Next after each one.

  5. In the Advanced tab, paste the contents of the cloud-init file you downloaded from EZSSH into the Custom data field.

    Azure Create VM Advanced tab with Custom data field containing EZSSH cloud init script
  6. Click Review + create, and then click Create.

How to Add the EZSSH cloud-init File to an AWS EC2 Instance

  1. Sign in to your AWS Console.

  2. Select the region where you want to deploy.

  3. Navigate to EC2 > Instances.

  4. Click Launch instances.

    AWS EC2 console showing Launch Instance button highlighted
  5. Select your operating system and your instance type.

    AWS EC2 Choose Instance Type step with Next: Configure Instance Details button highlighted
  6. Expand Advanced details and scroll down to the bottom.

  7. Paste the contents of the cloud-init file you downloaded from EZSSH into the User data field.

    AWS EC2 Advanced Details section showing User data field with EZSSH cloud init script pasted
  8. Continue with your regular EC2 instance deployment.

Done! Once the VM finishes booting, it trusts your EZSSH policy.

Next Steps - How to Connect to Your New Endpoint

If you are using a Hybrid Policy, remember to add the IP address or FQDN of the new VM to the Policy Endpoints of your policy. Azure Policies detect new VMs when you click Refresh Endpoints while editing the policy.

Now that your endpoint trusts your EZSSH policy, you can connect to it with the EZSSH client.

🚀 Set Up the EZSSH Client