How to Connect Amazon EC2 Using Microsoft Remote Desktop in macOS

freeCodeCampfreeCodeCamp
3 min read

By Clark Jason Ngo

I created this guide because of an experience I had while teaching. My students needed to use an application that was only available on Windows OS but the students only had macOS.

We will be touching on the technologies shown below:

Image

  • Amazon EC2: launch a Windows Server 2019
  • Microsoft Remote Desktop: macOS application to remote desktop connect (RDP) to EC2

Amazon EC2

Launching a Windows Server EC2 Instance

  1. Sign in to your AWS Management Console.
  2. Choose Services, then EC2.
  3. In the sidebar, click Instances.

Image EC2 sidebar

  1. Click Launch Instance.

Image Launch Instance button

  1. Scroll down and choose Microsoft Windows Server 2019 Base.

Image Choose AMI page

  1. At the bottom of the Choose Instance Type page, click Review and Launch. This will skip you to the Review page.

Image Launch with minimal configuration

  1. In the Review page, click Launch. You'll be prompted to select an existing key pair or new key pair.

If you choose Create a new key pair, you need to give the new key pair a name, then download the key pair. Then you'll be able to proceed to choose Launch Instance.

Image Key pair to access the instance

If you choose Choose an existing key pair, you need to select a key pair and tick the checkbox to acknowledge the use of the key pair.

Image Last step to launch instance

  1. Click the generated Instance ID.

Image Accessing the EC2 Instance

  1. Find and save the following information:

  2. Public DNS (IP Address)

  3. Username
  4. Password

To get the IP Address, scroll to the right of your EC2 instance:

Image IP Address of EC2 Instance

You can also find this in the Description tab below:

Image IP Address of EC2 Instance

  1. To get the username and password, choose the EC2 instance (tick the checkbox), click Actions, then Get Windows Password.

Image Obtaining the username and password

You may encounter Password not available and you'll need to wait a couple of minutes.

Image Provisioning the auto-generated password

  1. Locate the existing key pair or the newly created key pair you have downloaded in your local machine. Click Choose File.

Image Retrieve the key pair

  1. After uploading the key pair, click Decrypt Password.

Image

  1. Copy the following information and save it in a file or clipboard. Click Close when you are done.

Image Information for remote desktop connection

Microsoft Remote Desktop

Installing the application and connecting to EC2 instance

  1. Open your App Store, then search for Microsoft Remote Desktop. Click Install (it shows UPDATE here as I already have installed).

Image Microsoft Remote Desktop in the App Store

  1. After installation, Open Microsoft Remote Desktop.

  2. At the top, click the + Icon and choose Desktop.

Image Creating a new desktop connection

  1. In the PC name, copy the EC2 Instance IP address, then click Add.

Image Adding the IP address

  1. Copy the Administrator and Password from earlier and paste it here. Hit Continue.

Image Signing in with the username and password

You are now connected to your Windows Server EC2 Instance.

Image Windows Server EC2 Instance

Note: To avoid getting charged after you have used up the free tier for EC2, either click Stop to have a lower cost, or Terminate to remove the instance and not be charged.

You have access to this by selecting the instance and choosing Actions > Instance State > Stop/Terminate.

Image

Here's a video tutorial:

Connect with me on LinkedIn here.

Image

0
Subscribe to my newsletter

Read articles from freeCodeCamp directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

freeCodeCamp
freeCodeCamp

Learn to code. Build projects. Earn certifications—All for free.