Connect to a Windows Server on AWS EC2

by

Overview

In the previous lesson, we learned how to create a Windows Server instance on AWS EC2. The primary reason for using a Windows Server is its graphical user interface (UI), which makes it easier for hands-on learning.

In this lesson, we will learn how to connect to a Windows Server instance. In the next lesson, we will explore how to create and connect to a Linux server.


Required Information

To connect to a Windows instance, you need the following details:

  1. IP Address of the server
  2. Username
  3. Password

To obtain this information, click on Connect in the AWS Console.

1. Getting the IP Address

In the AWS Console, you can find the public IPv4 address of your server. In my case, the IP is:

13.236.69.129

IP Address

2. Getting the Username and Password

To retrieve the username and password:

  • Right-click on the instance and select Connect.

Connect

  • Open the RDP Client tab and click Get Password.

RDP Client

At this step, AWS will prompt you to upload the private key file that was generated when you created the instance. This key is critical, so store it securely.

Private Key

  • After uploading the private key, click Decrypt Password.

AWS will then display the username and password for your EC2 instance.

Decrypted Password

For example:

Username: Administrator
Password: tl62&S%O;.Ef6!JHda55zY!Cwl04F8&C

Connecting to the Windows Server

With the required details, you can now connect to your server.

On Windows:

Use Remote Desktop Connection.

On macOS:

Use Microsoft Remote Desktop.

Since I am using macOS, I will demonstrate the connection using Microsoft Remote Desktop.

Steps:

  1. Open Microsoft Remote Desktop and click Add PC.
  2. Enter the server IP address and account details.

Add PC

  1. Save the connection, then right-click the server and click Connect.
  2. Enter the password when prompted.

Enter Password

If successful, you will be connected to your Windows Server.

Connected

This instance functions like a normal PC but is running on AWS.


Stopping and Restarting the Instance

After finishing your session, it's best to stop the instance to avoid unnecessary charges.

  1. Right-click on the instance and select Stop Instance.

Stop Instance

Once stopped, AWS will no longer charge for CPU and RAM usage. However, when you restart the instance, the public IP address will change.

For example, my IP changed from:

13.236.69.129 → 54.206.67.235

New IP


Why Does the IP Address Change?

AWS assigns dynamic IP addresses by default because:

  • Public IPv4 addresses are limited and costly.
  • EC2 instances are ephemeral and meant to be replaceable.
  • Many cloud architectures use auto-scaling groups, which create and terminate instances dynamically.

This is why deploying applications directly on a single EC2 instance is not scalable. Instead, applications should be designed for high availability and scalability, leveraging load balancers and auto-scaling groups.

While we won’t cover scaling in depth in this lesson, it’s an essential concept for cloud applications.


Assigning a Static IP Address (Elastic IP)

If you want a fixed IP address, AWS provides Elastic IPs. Follow these steps to assign an Elastic IP:

1. Allocate an Elastic IP

  • In the AWS Console, navigate to Elastic IPs.

Elastic IP

  • Click Allocate IP Address.

Allocate IP

  • Click Allocate.

Allocated IP

AWS will provide a new static IP address.

2. Associate the Elastic IP

  • Right-click the allocated Elastic IP and choose Associate Elastic IP Address.

Associate Elastic IP

  • Select the instance and click Associate.

Confirm Association

Once assigned, your instance will retain the same IP address even if restarted.

Important Consideration

If your application relies on a single EC2 instance with a fixed Elastic IP, your architecture is not scalable. Cloud-native applications should be designed to be stateless and distributed, leveraging load balancers and auto-scaling. We will explore this in more detail in future lessons.


Summary

  • We learned how to retrieve IP address, username, and password to connect to a Windows Server.
  • We successfully connected using Remote Desktop.
  • We explored why AWS assigns dynamic IPs and how to use Elastic IPs for a static IP address.
  • We discussed why applications should be scalable and not rely on a single instance.

In the next lesson, we will learn how to create and connect to a Linux server on AWS EC2.