Connect to the source servers
Connect to the source servers
- The two source servers
wordpress-web.onpremsim.env and wordpress-db.onpremsim.env have no SSH key, no password, and no inbound ports. We open shells on them with AWS Systems Manager Session Manager.
- This works because each server has an instance profile with the
AmazonSSMManagedInstanceCore policy and connects to Systems Manager endpoints over outbound HTTPS (port 443) through the NAT gateway of the source VPC.
- Each session starts with user
ssm-user in the sh shell (in the /usr/bin directory), so always run bash and then cd ~ first.
- The servers are usually ready for Session Manager as soon as the stack reaches
CREATE_COMPLETE.
In a real on-premises data center, you access servers through the internal network, a VPN, or a jump box. In this lab, the “on-premises” servers are actually EC2 instances, so Session Manager is simply a convenient and secure replacement for that access path. Session Manager does not participate in DRS replication. Real on-premises servers do not have an EC2 instance profile, which is why section 5 still creates credentials for the replication agent.
Session Manager in the EC2 console
-
Open the EC2 console
- In the search bar, type EC2, then select EC2.
- If the Region selector at the top right does not show Oregon, select US West (Oregon) us-west-2.
- In the left menu, select Instances. The list contains
wordpress-web.onpremsim.env and wordpress-db.onpremsim.env, both Running.
- Tick the checkbox of the wordpress-web.onpremsim.env instance.
- Select Connect.

-
On the Connect to instance page
- Select the Session Manager tab.
- Select Connect (the orange button).
- If the tab says that the SSM Agent is not online, or the Connect button is greyed out, wait 2–3 minutes after the stack reaches
CREATE_COMPLETE, then reload the page.

-
In the Session Manager window for wordpress-web.onpremsim.env
- The terminal opens in a new browser tab with a
sh-5.2$ prompt. Run these commands:
cd ~
hostname
getent hosts wordpress-db.onpremsim.env
curl -s http://localhost/wp-admin/install.php | grep -o '<title>.*</title>'
wordpress-web.onpremsim.env
10.0.1.20 wordpress-db.onpremsim.env
<title>WordPress › Installation</title>
hostname displays the server name, getent hosts shows that the private DNS zone onpremsim.env works, and the WordPress installation page title means that the web server has connected to the database.
- Select Terminate (top right of the terminal page), then select Terminate in the dialog. You can close this browser tab.

-
Return to EC2 → Instances
- Tick the checkbox of wordpress-db.onpremsim.env. If wordpress-web.onpremsim.env is still ticked, untick it.
- Select Connect.

-
On the Connect to instance page
- The instance ID is the
DbServerInstanceId value in the stack outputs.
- Select the Session Manager tab.
- Select Connect.

-
In the Session Manager window for wordpress-db.onpremsim.env, run:
cd ~
hostname
sudo systemctl status mariadb --no-pager
hostname returns wordpress-db.onpremsim.env, and the mariadb service shows Active: active (running).
- Select Terminate (top right of the terminal page), then select Terminate in the dialog. You can close this browser tab.
