Trong phần này, chúng ta cài đặt AWS Replication Agent lên cả hai máy chủ nguồn bằng credentials đã tạo ở phần 5. Sau đó agent sẽ replicate các ổ đĩa sang một replication server mà DRS khởi chạy trong subnet DRS Staging.
Truy cập vào giao diện EC2
wordpress-web.onpremsim.env và wordpress-db.onpremsim.env, cả hai ở trạng thái Running.
Trong giao diện Connect to instance
sh-5.2$.
Trong cửa sổ Session Manager của wordpress-web.onpremsim.env: chuẩn bị máy chủ
~]$):bash
bash) và kiểm tra bạn đang ở thư mục home:cd ~
pwd
pwd phải trả về /home/ssm-user. Nếu dấu nhắc vẫn hiển thị bin hoặc pwd trả về /usr/bin, hãy chạy cd /home/ssm-user rồi pwd lại. Thư mục /usr/bin không cho ssm-user ghi file, nên bước tải trình cài đặt ở mục 4 sẽ lỗi Permission denied.uname -r
df -h /
uname -r trả về kernel dạng 6.1.x...amzn2023.x86_64 (ví dụ 6.1.188-233.393.amzn2023.x86_64), và df -h / cho thấy còn trống khoảng 8 GB (cần ít nhất 4 GB).kernel-devel phải khớp với kernel đang chạy:sudo dnf install -y kernel-devel-$(uname -r) gcc make

Complete!.
Trong cửa sổ Session Manager của wordpress-web.onpremsim.env: tải trình cài đặt
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

Trong cửa sổ Session Manager của wordpress-web.onpremsim.env: chạy trình cài đặt
<ACCESS_KEY_ID>, <SECRET_ACCESS_KEY> và <SESSION_TOKEN> bằng ba giá trị ở mục 5 của phần 5. Nếu ở phần 5 bạn dùng phương án dự phòng với IAM user, hãy xóa dòng cuối (--aws-session-token ...) và dấu \ ở cuối dòng trước nó.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. và Identifying volumes for replication., rồi hỏi bạn muốn replicate những ổ đĩa nào (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 ở mục 5 của phần 5 và dùng các giá trị mới.Lặp lại cho wordpress-db.onpremsim.env
The AWS Replication Agent was successfully installed. và in source server ID s-... riêng của máy này. Vì source network đã tồn tại, máy này in dòng Source Network already exists for vpc: vpc-....
Truy cập vào giao diện AWS Elastic Disaster Recovery
Ở thanh tìm kiếm, gõ DRS, rồi chọn AWS Elastic Disaster Recovery.
Ở menu bên trái, chọn Source servers.
Khoảng 7–10 phút sau khi cài, Data replication status chuyển sang Initial sync
Sau bước Start data transfer, Data replication status hiển thị Initial sync kèm phần trăm tiến độ.

Khoảng 15–60 phút sau khi cài, initial sync đạt 100%. Sau đó trạng thái hiển thị Creating snapshot khoảng 10–15 phút.

Khoảng 10–15 phút sau, cả hai máy chủ chuyển sang Ready / Healthy. Hãy đợi cả hai máy chủ đều Ready rồi mới bắt đầu drill ở phần 8. Trong lúc chờ, bạn có thể làm phần 7.