Installing the Agent

Install the Agent

In this section, we install the AWS Replication Agent on both source servers using the credentials created in section 5. The agent then replicates the disks to a replication server that DRS launches in the DRS Staging subnet.

  • Keep the CloudShell panel from section 5 open; you need the three credential values in it.
  • Items 1–2 open a Session Manager session exactly like Option A in section 3.
  1. Open the EC2 console

    • In the search bar, type EC2, then select EC2. The top bar shows Oregon.
    • In the left menu, select Instances. The list shows wordpress-web.onpremsim.env and wordpress-db.onpremsim.env, both Running.
    • Tick the checkbox for wordpress-web.onpremsim.env (select only this server).
    • Select Connect.

    AWS Elastic Disaster Recovery Workshop

  2. On the Connect to instance page

    • Select the Session Manager tab.
    • Select Connect (the orange button). A terminal opens in a new browser tab with a sh-5.2$ prompt.

    AWS Elastic Disaster Recovery Workshop

  3. In the Session Manager window for wordpress-web.onpremsim.env: prepare the server

    • Switch to bash and go to the home directory (the prompt changes to a bash prompt ending in ~]$):
    bash
    
    • After the prompt changes to bash, type each command separately (do not paste them together with bash) and verify that you are in the home directory:
    cd ~
    pwd
    
    • pwd must return /home/ssm-user. If the prompt still shows bin or pwd returns /usr/bin, run cd /home/ssm-user and then pwd again. The /usr/bin directory cannot be written to by ssm-user, so downloading the installer in item 4 would fail with Permission denied.
    • Check the kernel and available disk space:
    uname -r
    df -h /
    
    • uname -r returns a kernel in the form 6.1.x...amzn2023.x86_64 (for example 6.1.188-233.393.amzn2023.x86_64), and df -h / shows about 8 GB free (at least 4 GB is required).
    • Install the build tools. The agent builds a kernel module, so kernel-devel must match the running kernel:
    sudo dnf install -y kernel-devel-$(uname -r) gcc make
    

    AWS Elastic Disaster Recovery Workshop

    • The command takes about 1–2 minutes; the last line is Complete!.

    AWS Elastic Disaster Recovery Workshop

  4. In the Session Manager window for wordpress-web.onpremsim.env: download the installer

    • Download the agent installer for Region us-west-2 and make it executable:
    wget -O ./aws-replication-installer-init https://aws-elastic-disaster-recovery-us-west-2.s3.us-west-2.amazonaws.com/latest/linux/aws-replication-installer-init
    chmod +x aws-replication-installer-init
    

    AWS Elastic Disaster Recovery Workshop

  5. In the Session Manager window for wordpress-web.onpremsim.env: run the installer

    • Copy the installation command below into a text editor on your computer and replace <ACCESS_KEY_ID>, <SECRET_ACCESS_KEY> and <SESSION_TOKEN> with the three values from item 5 of section 5. If you used the IAM user fallback in section 5, remove the final line (--aws-session-token ...) and the \ at the end of the preceding line.
    sudo ./aws-replication-installer-init --region us-west-2 \
      --aws-access-key-id <ACCESS_KEY_ID> \
      --aws-secret-access-key <SECRET_ACCESS_KEY> \
      --aws-session-token <SESSION_TOKEN>
    
    • Copy the edited command, paste it into the Session Manager terminal, and press Enter. The installer prints The installation of the AWS Replication Agent has started. and Identifying volumes for replication., then asks which disks to replicate (Choose the disks you want to replicate … To replicate all disks, press Enter).
    • Press Enter to replicate all disks. After about 2–3 minutes, the installation ends with lines like these (your ID will differ):
    Identified volume for replication: /dev/nvme0n1 of size 10 GiB
    All volumes for replication were successfully identified.
    Downloading the AWS Replication Agent onto the source server... 
    Finished.
    Installing the AWS Replication Agent onto the source server... 
    Finished.
    Syncing the source server with the Elastic Disaster Recovery Console... 
    Finished.
    The following is the Source Network ID: sn-5dbb49d4b5c4c30c2.
    The following is the source server ID: s-57563b7b015de222b.
    The AWS Replication Agent was successfully installed.
    

    AWS Elastic Disaster Recovery Workshop

    • Select Terminate (top right of the terminal page), then select Terminate in the dialog. You can close this browser tab.
STS credentials expire after 1 hour. If they have expired when you install the second server, run the aws sts assume-role command from item 5 of section 5 again and use the new values.
  1. Repeat for wordpress-db.onpremsim.env

    • Repeat items 1–5 on wordpress-db.onpremsim.env.
    • The installer also ends with The AWS Replication Agent was successfully installed. and prints a separate source server ID s-... for this server. Because the source network already exists, this server prints Source Network already exists for vpc: vpc-....

    AWS Elastic Disaster Recovery Workshop

  2. Open the AWS Elastic Disaster Recovery console

    • In the search bar, type DRS, then select AWS Elastic Disaster Recovery.

    • In the left menu, select Source servers.

    • About 7–10 minutes after installation, Data replication status changes to Initial sync.

    • After Start data transfer, Data replication status shows Initial sync with a progress percentage.

    AWS Elastic Disaster Recovery Workshop

  3. About 15–60 minutes after installation, the initial sync reaches 100%. The status then shows Creating snapshot for about 10–15 minutes.

    AWS Elastic Disaster Recovery Workshop

About 10–15 minutes later, both servers change to Ready / Healthy. Wait until both servers are Ready before starting the drill in section 8. You can do section 7 while waiting.