Skip to content

AWS Setup

The AWS integration lets you manage EC2 instances directly from Reoclo. Once connected, you can reboot, shut down, and power on instances, view CloudWatch metrics, inspect security groups and volumes, and execute commands remotely via SSM Run Command.

The same credential can also run build servers, EC2 builders that Reoclo creates for your builds and deletes or stops when they are idle, and test servers, machines Reoclo creates for each test job and deletes when the job ends. Tick Build servers or Test servers in the policy builder below to set them up with the same key.

  • An AWS account
  • Permission to create IAM users and policies in that account
  • A Reoclo account with server management access

Pick what Reoclo may do and in which regions, then copy the result. The policy grants only the calls Reoclo makes, and you can narrow it further:

  • Regions limit every write action (start, stop, reboot, Run Command, builder and test machine launches) to the regions you add. Leave the list empty to cover every region.
  • Only instances tagged reoclo-managed=true limits power operations and Run Command to instances you have tagged.
  • AWS account ID replaces the wildcard account in each ARN.
Permissions
Regions

No region picked, so the policy covers every region.

Scope and names
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ReocloEC2Read",
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeInstances",
        "ec2:DescribeInstanceStatus",
        "ec2:DescribeInstanceTypes",
        "ec2:DescribeRegions",
        "ec2:DescribeVolumes"
      ],
      "Resource": "*"
    },
    {
      "Sid": "ReocloEC2Control",
      "Effect": "Allow",
      "Action": [
        "ec2:StartInstances",
        "ec2:StopInstances",
        "ec2:RebootInstances"
      ],
      "Resource": "arn:aws:ec2:*:*:instance/*"
    },
    {
      "Sid": "ReocloCloudWatch",
      "Effect": "Allow",
      "Action": "cloudwatch:GetMetricStatistics",
      "Resource": "*"
    },
    {
      "Sid": "ReocloCostExplorer",
      "Effect": "Allow",
      "Action": "ce:GetCostAndUsage",
      "Resource": "*"
    },
    {
      "Sid": "ReocloSSMRead",
      "Effect": "Allow",
      "Action": [
        "ssm:DescribeInstanceInformation",
        "ssm:GetCommandInvocation",
        "ssm:ListCommandInvocations"
      ],
      "Resource": "*"
    },
    {
      "Sid": "ReocloSSMDocument",
      "Effect": "Allow",
      "Action": "ssm:SendCommand",
      "Resource": "arn:aws:ssm:*::document/AWS-RunShellScript"
    },
    {
      "Sid": "ReocloSSMInstances",
      "Effect": "Allow",
      "Action": "ssm:SendCommand",
      "Resource": "arn:aws:ec2:*:*:instance/*"
    },
    {
      "Sid": "ReocloVerify",
      "Effect": "Allow",
      "Action": "sts:GetCallerIdentity",
      "Resource": "*"
    }
  ]
}

Policy size: 1,066 of 6,144 characters.

Step 2: Create an IAM User with the Policy

Section titled “Step 2: Create an IAM User with the Policy”

The AWS CLI and Terraform tabs above create the user, the policy and an access key in one go. If you used them, skip to Step 4. In the AWS console:

  1. Log into the AWS Console and open IAM > Users > Create user
  2. Enter a username (for example, reoclo-service)
  3. Leave Provide user access to the AWS Management Console unchecked, and click Next
  4. Choose Attach policies directly, then click Create policy
  5. Open the JSON tab and paste the policy from Step 1
  6. Name the policy (for example, ReocloAccess) and create it
  7. Back on the user, refresh the list, select the new policy, and finish creating the user
  1. Open the new IAM user
  2. Navigate to Security credentials > Access keys
  3. Click Create access key
  4. Select Third-party service as the use case
  5. Copy both the Access Key ID (starts with AKIA) and the Secret Access Key
  1. In Reoclo, navigate to Cloud Providers in the sidebar
  2. Click Add Provider
  3. Select Amazon Web Services from the dropdown
  4. Enter a label (for example, my-aws-prod)
  5. Paste your Access Key ID and Secret Access Key
  6. Choose its Regions: the regions build and test pools on this credential may use. The first is the default for new pools. Server management works in every region the policy allows, whatever you pick.
  7. Click Test & Save to verify the credential

Reoclo will call sts:GetCallerIdentity to confirm the keys are valid. If successful, you will see your AWS account ID and IAM user displayed.

You can add or remove regions later with Edit next to Regions on the credential’s page. A region a pool still uses cannot be removed.

  1. Navigate to Servers and click Add Server
  2. Select your AWS credential as the cloud provider
  3. Enter the EC2 Instance ID (for example, i-0123456789abcdef0)
  4. Select the Region where the instance runs (for example, us-east-1)
  5. Save

Reoclo will begin syncing instance metadata, including status, IP addresses, specs, security groups, tags, and attached volumes.

Servers you added another way, for example by installing the runner, link to their EC2 instance automatically when the instance’s IP address matches. Reoclo searches the regions listed on the credential, so list every region your instances run in. The server’s region fills in from the instance. See Automatic linking.

From the server detail page, you can:

  • Power On a stopped instance
  • Shutdown (graceful stop)
  • Reboot the instance
  • Hard Reset (force stop, then start)

Operations are tracked in real time with progress indicators.

Reoclo pulls CPU, network, and disk I/O metrics from CloudWatch automatically and shows them on the server detail page.

With the Cost Explorer permission, each sync shows the instance’s month-to-date cost. Cost Explorer must be enabled in your account’s billing console, and AWS charges $0.01 per Cost Explorer API request.

If your EC2 instances have the SSM Agent installed, you can execute commands directly from Reoclo without SSH access.

Requirements for SSM:

  1. The instance must have an IAM instance profile with the AmazonSSMManagedInstanceCore managed policy attached
  2. The SSM Agent must be installed and running (pre-installed on Amazon Linux 2, Amazon Linux 2023, Ubuntu 16.04+, and Windows Server 2016+)
  3. The instance must have a network path to SSM endpoints (direct internet access, or VPC endpoints for ssm, ssmmessages, and ec2messages)

When SSM is available, the server detail page shows a green SSM ready badge and a Run Command panel where you can execute shell commands and view output.

If SSM is not available, a gray SSM unavailable badge appears with troubleshooting guidance.

Ephemeral and sleep build pools create EC2 builders with this credential, in the pool’s region and that region’s default VPC. Builders carry the reoclo-managed=true tag, and the policy only lets the key start, stop and terminate tagged instances. See Build servers to create a pool.

Test pools create their machines with this credential too, in the pool’s region. Test machines carry the same reoclo-managed=true tag as builders. The policy from Step 1 covers them when Test servers or Build servers was ticked. A policy built for server management alone cannot launch them: build it again with Test servers ticked and replace the policy in IAM.

A test pool can use spot instances. The first spot request in an AWS account needs the EC2 Spot service-linked role, and the policy builder adds permission to create just that role (iam:CreateServiceLinkedRole, limited to spot.amazonaws.com) when Test servers is ticked. A key built before spot pools existed needs the policy built again, or run aws iam create-service-linked-role --aws-service-name spot.amazonaws.com once. See Spot instances and Run tests on test servers.

  • Confirm the Access Key ID starts with AKIA
  • Confirm the Secret Access Key was copied completely (no trailing spaces)
  • Check that the IAM user has not been deactivated or deleted

An operation fails with “UnauthorizedOperation”

Section titled “An operation fails with “UnauthorizedOperation””

The policy does not allow the call. The usual causes are an instance in a region the policy does not list, or an untagged instance when the policy is limited to tagged ones. Rebuild the policy in Step 1 with the region or option you need, and replace the policy on the IAM user.

Power operations fail with “IncorrectInstanceState”

Section titled “Power operations fail with “IncorrectInstanceState””

This means the instance is in a state that does not allow the requested operation. For example, you cannot start an instance that is already running. Wait for the current transition to complete and try again.

Check the three requirements listed above:

  1. Instance profile with AmazonSSMManagedInstanceCore
  2. SSM Agent installed and running
  3. Network path to SSM endpoints

You can verify SSM Agent status in the AWS Console under Systems Manager > Fleet Manager.

Metrics show “Requires CloudWatch Agent”

Section titled “Metrics show “Requires CloudWatch Agent””

Basic EC2 monitoring includes CPU and network metrics. Disk usage requires the CloudWatch Agent to be installed on the instance.