Guided Lab: Using EC2 Instance Connect to connect to your Instance
Description
Amazon EC2 Instance Connect provides a simple and secure way to connect to your EC2 instances using Secure Shell (SSH). It eliminates the need for managing SSH keys manually and enhances the security of your instances. This lab will guide you through the process of setting up EC2 Instance Connect and connecting to an EC2 instance.
Prerequisites
This lab assumes you have experience creating EC2 instances and are familiar with its basic components.
If you find any gaps in your knowledge, consider taking the following labs:
- Creating an Amazon EC2 instance (Linux)
Objectives
In this lab, you will:
- Understand the concept of EC2 Instance Connect.
- Configure EC2 instances to allow connections using EC2 Instance Connect.
- Connect to an EC2 instance using EC2 Instance Connect.
Lab Steps
Launching your EC2 Instance
1. Search “ec2” in the AWS Management Console search bar. Click EC2 on the search results.
2. Launch EC2 instance with the following configurations.
- Name: td-instance-connect-guide
- AMI: Amazon Linux
- Instance type: t2.micro
- Key pair: (Optional) Proceed without a key pair
- Network settings:
- Allow SSH traffic from: Anywhere
- Auto-assign public IP: Enable (If not enabled, do these steps before launching your EC2 instance.)
- Under Network Settings, click “Edit”.
- Under the “Auto-assign public IP” dropdown, select “Enable”.
Connecting to your EC2 Instance via EC2 Instance Connect
1. Search ‘ec2‘ in the AWS Management Console search bar. Click EC2 on the search results.
2. Select the EC2 Instance you will be connecting.
3. Ensure that you have a “Public IP address” assigned, and click “Connect” in the upper right corner of the console.
Warning: Never expose your EC2 instance’s public IP openly without proper security measures. Consider using a VPN or restricting access to known IP addresses to enhance security.
Note: The public IP address of your EC2 instance will change if it is stopped and started. Consider using an Elastic IP if you want a static public IP.
4. You will be redirected to a new tab (if not, your window should load like the image below). Go to the “EC2 Instance Connect” tab. Click “Connect”.
5. Congratulations! You have successfully configured EC2 Instance Connect and connected to your EC2 instance using the AWS Management Console.
Tips: Add to your habit of cleaning up the resources after your labs (i.e. in this case, terminating your Instance). This is not only a good habit but gives you good practice in taking responsibility for your resources.