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.
Open the EC2 console
wordpress-web.onpremsim.env and wordpress-db.onpremsim.env, both Running.
On the Connect to instance page
sh-5.2$ prompt.
In the Session Manager window for wordpress-web.onpremsim.env: prepare the server
~]$):bash
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.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).kernel-devel must match the running kernel:sudo dnf install -y kernel-devel-$(uname -r) gcc make

Complete!.
In the Session Manager window for wordpress-web.onpremsim.env: download the installer
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

In the Session Manager window for wordpress-web.onpremsim.env: run the installer
<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>
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).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 sts assume-role command from item 5 of section 5 again and use the new values.Repeat for wordpress-db.onpremsim.env
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-....
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.

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

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.