Under Application and OS Images (Amazon Machine Image), do the following:
- Choose Quick Start, and then choose the operating system (OS) for your instance. For your first Linux instance, we recommend that you choose Amazon Linux.
- From Amazon Machine Image (AMI), select an AMI that is marked Free Tier eligible .
Warning
If you choose Proceed without a key pair (Not recommended), you won't be able to connect to your instance using the methods described in this tutorial.
- (Optional) To use a specific default subnet, choose Edit and then choose a subnet.
- (Optional) To use a different VPC, choose Edit and then choose an existing VPC. If the VPC isn't configured for public internet access, you won't be able to connect to your instance.
- (Optional) To restrict inbound connection traffic to a specific network, choose Custom instead of Anywhere, and enter the CIDR block for your network.
- (Optional) To use a different security group, choose Select existing security group and choose an existing security group. If the security group does not have a rule that allows connection traffic from your network, you won't be able to connect to your instance. For a Linux instance, you must allow SSH traffic. For a Windows instance, you must allow RDP traffic.
Step 2: Connect to your instance
The procedure that you use depends on the operating system of the instance. If you can't connect to your instance, see Troubleshoot issues connecting to your Amazon EC2 Linux instance for assistance.
You can connect to your Linux instance using any SSH client. If you are running Windows on your computer, open a terminal and run the ssh command to verify that you have an SSH client installed. If the command is not found, install OpenSSH for Windows .
To connect to your instance using SSH
- Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/ .
- In the navigation pane, choose Instances.
- Select the instance and then choose Connect.
- On the Connect to instance page, choose the SSH client tab.
- (Optional) If you created a key pair when you launched the instance and downloaded the private key (.pem file) to a computer running Linux or macOS, run the example chmod command to set the permissions for your private key.
- Copy the example SSH command. The following is an example, where key-pair-name .pem is the name of your private key file, ec2-user is the username associated with the image, and the string after the @ symbol is the public DNS name of the instance.
ssh -i key-pair-name
.pem ec2-user
@ec2-198-51-100-1.us-east-2.compute.amazonaws.com
The authenticity of host 'ec2-198-51-100-1.us-east-2.compute.amazonaws.com (198-51-100-1)' can't be established. ECDSA key fingerprint is l4UB/neBad9tvkgJf1QZWxheQmR59WgrgzEimCG6kZY. Are you sure you want to continue connecting (yes/no)?
Warning: Permanently added 'ec2-198-51-100-1.us-east-2.compute.amazonaws.com' (ECDSA) to the list of known hosts.
To connect to a Windows instance using RDP, you must retrieve the initial administrator password and then enter this password when you connect to your instance. It takes a few minutes after instance launch before this password is available.
The default username for the Administrator account depends on the language of the operating system (OS) contained in the AMI. To ascertain the correct username, identify the language of your AMI's OS, and then choose the corresponding username. For example, for an English OS, the username is Administrator , for a French OS it's Administrateur , and for a Portuguese OS it's Administrador . If a language version of the OS does not have a username in the same language, choose the username Administrator (Other) . For more information, see Localized Names for Administrator Account in Windows in the Microsoft TechNet Wiki.
To retrieve the initial administrator password
- Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/ .
- In the navigation pane, choose Instances.
- Select the instance and then choose Connect.
- On the Connect to instance page, choose the RDP client tab.
- For Username, choose the default username for the Administrator account. The username you choose must match the language of the operating system (OS) contained in the AMI that you used to launch your instance. If there is no username in the same language as your OS, choose Administrator (Other).
- Choose Get password.
- On the Get Windows password page, do the following:
- Choose Upload private key file and navigate to the private key ( .pem ) file that you specified when you launched the instance. Select the file and choose Open to copy the entire contents of the file to this window.
- Choose Decrypt password. The Get Windows password page closes, and the default administrator password for the instance appears under Password, replacing the Get password link shown previously.
- Copy the password and save it in a safe place. This password is required to connect to the instance.
The following procedure uses the Remote Desktop Connection client for Windows (MSTSC). If you're using a different RDP client, download the RDP file and then see the documentation for the RDP client for the steps to establish the RDP connection.
To connect to a Windows instance using an RDP client
- On the Connect to instance page, choose Download remote desktop file. When the file download is finished, choose Cancel to return to the Instances page. The RDP file is downloaded to your Downloads folder.
- Run mstsc.exe to open the RDP client.
- Expand Show options, choose Open, and select the .rdp file from your Downloads folder.
- By default, Computer is the public IPv4 DNS name of the instance and User name is the administrator account. To connect to the instance using IPv6 instead, replace the public IPv4 DNS name of the instance with its IPv6 address. Review the default settings and change them as needed.
- Choose Connect. If you receive a warning that the publisher of the remote connection is unknown, choose Connect to continue.
- Enter the password that you saved previously, and then choose OK.
- Due to the nature of self-signed certificates, you might get a warning that the security certificate could not be authenticated. Do one of the following:
- If you trust the certificate, choose Yes to connect to your instance.
- [Windows] Before you proceed, compare the thumbprint of the certificate with the value in the system log to confirm the identity of the remote computer. Choose View certificate and then choose Thumbprint from the Details tab. Compare this value to the value of RDPCERTIFICATE-THUMBPRINT in Actions, Monitor and troubleshoot, Get system log.
- [Mac OS X] Before you proceed, compare the fingerprint of the certificate with the value in the system log to confirm the identity of the remote computer. Choose Show Certificate, expand Details, and choose SHA1 Fingerprints. Compare this value to the value of RDPCERTIFICATE-THUMBPRINT in Actions, Monitor and troubleshoot, Get system log.
- If the RDP connection is successful, the RDP client displays the Windows login screen and then the Windows desktop. If you receive an error message instead, see Remote Desktop can't connect to the remote computer. When you are finished with the RDP connection, you can close the RDP client.
Step 3: Clean up your instance
After you've finished with the instance that you created for this tutorial, you should clean up by terminating the instance. If you want to do more with this instance before you clean up, see Next steps.
Important
Terminating an instance effectively deletes it; you can't reconnect to an instance after you've terminated it.
You'll stop incurring charges for that instance or usage that counts against your Free Tier limits as soon as the instance status changes to shutting down or terminated . To keep your instance for later, but not incur charges or usage that counts against your Free Tier limits , you can stop the instance now and then start it again later. For more information, see Stop and start Amazon EC2 instances.
To terminate your instance
- In the navigation pane, choose Instances. In the list of instances, select the instance.
- Choose Instance state, Terminate instance.
- Choose Terminate when prompted for confirmation. Amazon EC2 shuts down and terminates your instance. After your instance is terminated, it remains visible on the console for a short while, and then the entry is automatically deleted. You cannot remove the terminated instance from the console display yourself.
Next steps
After you start your instance, you might want to explore the following next steps:
- Learn how to track your Amazon EC2 Free Tier usage using the console. For more information, see Track your Free Tier usage for Amazon EC2.
- Configure a CloudWatch alarm to notify you if your usage exceeds the Free Tier. For more information, see Tracking your AWS Free Tier usage in the AWS Billing User Guide.
- Add an EBS volume. For more information, see Create an Amazon EBS volume in the Amazon EBS User Guide.
- Learn how to remotely manage your EC2 instance using the Run command. For more information, see AWS Systems Manager Run Command in the AWS Systems Manager User Guide.
- Learn about instance purchasing options. For more information, see Amazon EC2 billing and purchasing options.
- Get advice about instance types. For more information, see Get recommendations from EC2 instance type finder.