cfn-aws-three-tier-demo stack, copy the WebTierLoadBalancerURL value.




Go to the folder that contains cfn-keypair.pem.
SSH into the Bastion Host:
chmod 400 cfn-keypair.pem
ssh -i cfn-keypair.pem ec2-user@<BastionHostPIP>
On Windows, run the ssh command in PowerShell and skip the chmod command.

~/cfn-keypair.pem with vi.
Paste the private key content from the cfn-keypair.pem file on your computer.
Save it with :wq!.
vi ~/cfn-keypair.pem

Copy the private key to the Bastion Host only in a lab environment. The file is deleted together with the Bastion Host when you delete the stack. Do not share the private key content.
Get the private IP addresses of the Web Tier EC2 instances with the following command in the VS Code terminal (3-Tier is the default value of the EnvironmentName parameter):
aws ec2 describe-instances \
--filters "Name=tag:aws:autoscaling:groupName,Values=3-Tier-WebTier-AutoScaleGroup" "Name=instance-state-name,Values=running" \
--query "Reservations[].Instances[].PrivateIpAddress" \
--output text
8. On the Bastion Host, SSH into one of the Web Tier EC2 instances with the following commands:
chmod 400 ~/cfn-keypair.pem
ssh -i ~/cfn-keypair.pem ec2-user@<web_tier_ec2_private_ip>
