You can install the CloudRay Agent on Amazon EC2, using two methods:

  • Option 1: Installing on new instances using EC2 User Data
  • Option 2: Installing manually on existing EC2 instances

The CloudRay Agent securely connects your EC2 instance to the CloudRay dashboard without SSH, allowing you to monitor and manage it in real-time.

TIP

Before you begin, ensure you have a CloudRay account and obtain your REG_CODE from the project dashboard.

Option 1: New EC2 Instances (via User Data)

You can use EC2 User Data to automatically install and register the CloudRay Agent when launching a new instance.

  1. Launch a new EC2 instance from the AWS Console
  2. Under Advanced Details, locate the User Data section
Screenshot of AWS user data
  1. Paste the following script (replace <REG_CODE>):
#!/bin/bash
curl -sSfL https://cloudray.io/install.sh | bash
sudo cloudray-agent install-service --reg-code <REG_CODE>

The install.sh script is safe to run multiple times; it will automatically update the Agent if a newer version is available or leave it untouched if it’s already up to date.

  1. Complete the rest of the EC2 launch steps and start the instance

Option 2: Existing EC2 Instances

Install the CloudRay Agent manually on a running EC2 instance via SSH or Session Manager. For detailed connection instructions, refer to the official AWS EC2 connection documentation.

  1. Connect to your EC2 instance using EC2 Instance Connect or SSH.
  2. Run the following commands:
curl -sSfL https://cloudray.io/install.sh | sudo bash
sudo cloudray-agent install-service --reg-code <REG_CODE>
  1. Verify that the instance appears in your CloudRay dashboard under Machines

Alternative: Connect via SSH

If you’re unable to install the CloudRay Agent directly on your server, you can still connect and manage your server via SSH. CloudRay supports executing scripts over a standard SSH connection.

Keep in mind that some advanced functionalities—such as real-time monitoring and task syncing—are only available when the Agent is installed.

To learn more about managing Machines using SSH, see the Managing Machines SSH Keys documentation.