Ends in
00
days
00
hrs
00
mins
00
secs
SHOP NOW

PRE-BLACK FRIDAY SALE - GET 20% OFF ALL REVIEWERS

Guided Lab: How to launch an Amazon EC2 Windows instance

Description

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that allows you to easily create and manage virtual servers in the cloud. With Amazon EC2, you can set up and configure your own operating system and applications as per your requirements.

An Amazon EC2 instance is a virtual server that can be launched on AWS Cloud. When you launch an instance, it is secured with a key pair, which is used to prove your identity, and a security group that works as a virtual firewall to control incoming and outgoing traffic. When connecting to your instance, you must provide the private key of the key pair that you specified while launching the instance.

In this lab, you will be using Amazon EC2 to launch a virtual server with Windows as the operating system. This hands-on experience with cloud computing will help you understand how to use Amazon EC2 as a start for your own projects.

Objectives

In this lab, you will learn how to:

  • Create an EC2 instance (t2.micro)
  • Configure a security group for Remote Desktop Protocol (RDP) access
  • Connect to the instance via RDP
  • Learn about the Stop, Reboot, and Terminate operations

Lab Steps

Creating an Amazon EC2 instance (Windows)

1. Navigate to the search bar, type “EC2”, and click to open the EC2 Dashboard.

How to launch an Amazon EC2 Windows instance

2. Click on the ‘Launch Instance’ button.

How to launch an Amazon EC2 Windows instance

3. In the “Name and tags” section, you can add a name and create tags as key/value pairs. It’s recommended to tag AWS resources in production environments to stay organized, but it’s not mandatory. You can skip this section if you don’t want to create any tags for this lab.

4. You will need to select an Amazon Machine Image (AMI), which is basically a template of an Operating System platform that you can use as a foundation to create your instance.

For this lab, choose Windows.

How to launch an Amazon EC2 Windows instance

5. For the EC2 instance type, choose t2.micro.

6. In the Key pair section, you can create a new key pair by clicking on the “Create new key pair” button. Once you do this, enter “my-key-pair” as the name of the key pair, keep the default values for Key pair type and Private key file format, and then click the “Create key pair” button. This will initiate the download of the key pair as a file named “my-key-pair.pem” on your local system. This file contains a private key that you can use to connect to the EC2 instance.

How to launch an Amazon EC2 Windows instance
How to launch an Amazon EC2 Windows instance

7. In the Network Settings section, ensure that Allow RDP traffic from the checkbox is checked and Anywhere is selected under Security groups (Firewall).

How to launch an Amazon EC2 Windows instance

AWS Warning: The default configuration for the security group that is about to be created will allow RDP access from any source IP address (0.0.0.0/0). This warning is to remind you that production environments should have more restrictive security controls. However, for the purposes of this lab, this configuration is acceptable.

8. In the Configure storage section, ensure the default values of 8 GiB and gp2 Root volume are selected.

How to launch an Amazon EC2 Windows instance

9. Expand the section by clicking on Advanced Details, and take a moment to review the available configurations.

How to launch an Amazon EC2 Windows instance

10. Before clicking on the ‘Launch instance’ button to create your instance, make sure to review all of your settings.

How to launch an Amazon EC2 Windows instance

11. After clicking on the ‘Launch instance’ button, a confirmation page will appear to let you know that the process has started.

How to launch an Amazon EC2 Windows instance
Configuring a security group for Remote Desktop Protocol (RDP) access

1. Go to EC2 Dashboard and click the “Instances (running)” under Resources.

2. Select the instance you want to set up Security groups for by clicking the checkbox.

3. Navigate to the Security tab. Then, click on the security group ID, which typically begins with “sg-“.

How to launch an Amazon EC2 Windows instance

4. To connect to your Windows instance using RDP from your IP address, you can add rules to a security group.

How to launch an Amazon EC2 Windows instance
How to launch an Amazon EC2 Windows instance

To enhance the security of your instance, it is important to only authorize a specific IP address or range of addresses when setting up a rule to access it. Using 0.0.0.0/0 will allow all IPv4 addresses to access your instance via RDP. Similarly, using ::/0 will enable all IPv6 addresses to access your instance. To avoid these two options and provide a more secure solution, it is recommended to specify a particular IP address or range of addresses.

Connecting to the instance through RDP

1. After launching an instance, it may take a few minutes for it to be ready for connection.

2. Find the public DNS name or IP address of your instance. You’ll use this to connect.

How to launch an Amazon EC2 Windows instance

3. On your local machine, open the Remote Desktop Client application. You can do this by pressing Win + R, typing “mstsc,” and hitting Enter on Windows. On macOS, you can use the “Remote Desktop Connection” app or other RDP clients like Microsoft Remote Desktop from the App Store.

How to launch an Amazon EC2 Windows instance

4. In Remote Desktop Connection, enter the public IP address or hostname of the Windows instance you want to connect to in the “Computer” field.

How to launch an Amazon EC2 Windows instance

5. Click the “Connect” button to initiate the RDP connection.

How to launch an Amazon EC2 Windows instance

6. You will be prompted to enter your Windows instance username and password which can be found under the Connect settings of your instance.

How to launch an Amazon EC2 Windows instance
  • Under RDP Client, you can find here the Username and Password.
How to launch an Amazon EC2 Windows instance
  • Click the Get password.
  • Upload the key pair associated with your instance.
How to launch an Amazon EC2 Windows instance
  • After uploading the file, you need to click on the “Decrypt Password” button.
How to launch an Amazon EC2 Windows instance
  • Once done, you will be directed to the “Connect to Instance” page, where the RDP password will be generated automatically.
How to launch an Amazon EC2 Windows instance

7. After entering the credentials, click “OK” or “Connect” to start the connection. You might see a warning about the certificate; this is normal. You can choose to connect anyway.

How to launch an Amazon EC2 Windows instance

PEM (Privacy Enhanced Mail) and PPK (PuTTY Private Key) are both formats for storing private keys, which are used in public key cryptography. Here’s a comparison of the two:

PEM:

  • It is a base64 container format for encoding keys and certificates.
  • It is kind of the de facto standard for Linux, Mac, and Windows PowerShell users.
  • The .pem file is what you download from AWS when you create your key pair. This is a one-time download, and you cannot download it again.

PPK:

  • PPK is a format used by PuTTY, a Windows SSH client.
  • It does not support the .pem format. Hence, you have to convert it to .ppk format using PuTTYgen.
  • To use a PPK file with PuTTY, you need to load the PPK file in PuTTYgen and then save it as a private key. You can then use this private key to log into your server.

It’s crucial to keep private keys secure and never share them with unauthorized individuals as they are essential for secure communication over networks.

Learn about the Stop, Reboot, and Terminate operations

Stopping an EC2 instance

Steps:

  • Navigate to the EC2 dashboard.
  • Select the instance you want to stop.
  • Click the “Actions” button.
  • Click the “Instance State” option.
  • Click “Stop” from the dropdown menu.
How to launch an Amazon EC2 Windows instance

Effects:

When you stop an instance, the following is lost:

  • Data stored on the RAM.
  • Data stored on the instance store volumes.
  • The public IPv4 address that Amazon EC2 automatically assigns to the instance upon launch or start. To retain a public IPv4 address that never changes, you can associate an Elastic IP address with your instance.

When you stop an instance, the following persists:

  • Any attached Amazon EBS volumes.
  • Data is stored on the attached Amazon EBS volumes.
  • Private IPv4 addresses.
  • IPv6 addresses.
  • Elastic IP addresses associated with the instance. Note that you are charged for the associated Elastic IP addresses when the instance is stopped.

Rebooting an EC2 instance

Steps:

  • Navigate to the EC2 dashboard.
  • Select the instance you want to reboot.
  • Click the “Actions” button.
  • Click the “Instance State” option.
  • Click “Reboot” from the dropdown menu.
How to launch an Amazon EC2 Windows instance

Effects:

An instance reboot is equivalent to an operating system reboot. In most cases, it takes only a few minutes to reboot your instance.

When you reboot an instance, it keeps the following:

  • Public DNS name (IPv4)
  • Private IPv4 address
  • Public IPv4 address
  • IPv6 address (if applicable)
  • Any data on its instance store volumes

Rebooting an instance doesn’t start a new instance billing period (with a minimum one-minute charge), unlike stopping and starting your instance.

Terminating an EC2 instance:

Steps:

  • Navigate to the EC2 dashboard.
  • Select the instance you want to terminate.
  • Click the “Actions” button.
  • Click the “Instance State” option.
  • Click “Terminate” from the dropdown menu.
How to launch an Amazon EC2 Windows instance

Effects:

  • The instance will be shut down, and the virtual machine that was provisioned for you will be permanently taken away, and you will no longer be charged for instance usage.
  • Any data that was stored locally on the instance will be lost.
  • Any attached EBS volumes will be detached and deleted unless they are set to persist after termination.