Skip to content

Last updated: 2025-06-24

Setup AWS Target Servers

This section provides step-by-step instructions to prepare your AWS EC2 instances as target servers for ServerSage.
Once configured, ServerSage will be able to securely manage these instances at the request of your IT administrator.


Prerequisites

  • Your ServerSage Bastion must already be deployed Set up the Bastion first
  • You must have access to an AWS IAM role with AmazonSSMManagedInstanceCore permissions
  • Your AWS CLI must be installed and configured locally

Steps to Register an AWS Instance

Identify the Instance ID and Region

Run the following AWS CLI command to retrieve your EC2 instance ID and region:

aws ec2 describe-instances \
  --query 'Reservations[*].Instances[*].[InstanceId,Placement.AvailabilityZone]' \
  --output json \
  --no-cli-pager

This command lists all instances in your account, including their IDs and availability zones. This command depends on the AWS CLI being configured with the correct permissions to access EC2 resources.

Example output:

[
  [
    [
      "i-0abcd123456789xyz",
      "ap-southeast-1a"
    ]
  ]
]

The first value is your Instance ID
The second value includes the region (ap-southeast-1 in this example)
Please remove the last character to get the region (ap-southeast-1a -> ap-southeast-1)

Attach IAM Role to the Instance

Assign an IAM instance profile to your EC2 target. Use the IAM role created during Bastion setup.

aws ec2 associate-iam-instance-profile \
  --instance-id <instance-id> \
  --iam-instance-profile Name="<role-name>" \
  --no-cli-pager

Adjust These Values

Placeholder Description
instance-id Your target EC2 instance ID
role-name Name of the IAM role with SSM permissions

Verify that the IAM role was successfully associated

aws ec2 describe-instances --instance-ids <instance-id> \
  --query 'Reservations[*].Instances[*].IamInstanceProfile' \
  --no-cli-pager

Expected output:

[
  [
    {
      "Arn": "arn:aws:iam::123456789012:instance-profile/ServerSageRole",
      "Id": "AIPAEXAMPLE123"
    }
  ]
]

If necessary, reboot the instance to finalize role attachment:

aws ec2 reboot-instances --instance-ids <instance-id>

Check SSM Agent Status

SSH into the instance and verify the SSM agent is active:

sudo systemctl status amazon-ssm-agent

Expected output:

sudo systemctl status amazon-ssm-agent

Expected output:

 amazon-ssm-agent.service - Amazon EC2 Simple Systems Manager (SSM) Agent
   Loaded: loaded (...)
   Active: active (running) since ...

✅ If active, the instance is now ready to be registered in the ServerSage dashboard.

Register Target in ServerSage

  1. Log in to your ServerSage dashboard.
  2. Navigate to the Sidebar section.
  3. Choose Bastion.
  4. Click on Add Target.
  5. Enter the Instance ID and Region you retrieved earlier.

🎉 Your AWS instance is now ready to receive AI-powered instructions from ServerSage.