Assignment: Launch an EC2 Instance and Connect with Session Manager
In this assignment, you will practice launching an Amazon EC2 instance with default settings and connecting to it using AWS Systems Manager Session Manager. This hands-on exercise will help you become familiar with the basics of launching EC2 instances and secure access.Instructions:Step 1: Launch an EC2 Instance
- Log in to your AWS Management Console.
- Navigate to the EC2 Dashboard.
- Click on "Launch Instance."
- In the "Choose an Amazon Machine Image (AMI)" step, select an Amazon Linux 2 AMI (or another suitable image of your choice).
- In the "Choose an Instance Type" step, select an instance type (e.g., t2.micro).
- In the "Configure Instance Details" step:
--> Keep the default settings for VPC and Subnet (using the default VPC and subnet).
--> Enable "Auto-assign Public IP" to ensure the instance can communicate over the internet.
Step 2: Connect to the EC2 Instance Using Session Manager
- In the "Add Storage" step, accept the default storage settings.
- Continue through the "Add Tags" and "Configure Security Group" steps, keeping the default settings or customizing them as needed.
- In the "Review and Launch" step, review your instance configuration, and then click "Launch."
- Create a new key pair or use an existing one to securely access the instance. Download the private key file (.pem) and save it to a secure location.
Step 3: Test the Session
- Go to the AWS Systems Manager Console.
- In the navigation pane, choose "Session Manager" under "Instances & Nodes."
- Click on the "Start session" button.
- In the "Start a session" dialog, select the EC2 instance you just launched from the list of available instances.
- Click the "Start session" button to initiate the session.
You will now have a secure shell (SSH) session to your EC2 instance using Session Manager. You can run commands and interact with the instance directly through the AWS Management Console.
Execute some basic commands (e.g., ls
, sudo yum update
) to verify that you have successfully connected to the EC2 instance.Step 4: Terminate the EC2 Instance
- Once you have completed your tasks on the EC2 instance, make sure to terminate it to avoid incurring additional charges.
Confirm that you were able to successfully create an EC2 instance with default options and connect to it using Session Manager.
Take note of any issues you encountered and how you resolved them, if applicable.