Setting Up Your First EC2 Instance: A Step-by-Step Tutorial
Introduction
This tutorial will guide you through the process of setting up your first Amazon Web Services (AWS) Elastic Compute Cloud (EC2) instance. By the end of this tutorial, you will have a running EC2 instance that you can use for various applications.
Prerequisites
- An AWS account. If you don't have one, you can create it at the AWS website.
- Basic understanding of cloud computing concepts.
Step-by-Step Guide
Step 1: Sign in to AWS Management Console
- Navigate to the AWS Management Console and log in with your credentials.
Step 2: Access the EC2 Dashboard
- In the AWS Management Console, find and click on “Services” at the top, and select “EC2” to open the EC2 Dashboard.
Step 3: Launch a New EC2 Instance
- Click on the “Launch Instance” button to start the process of creating a new instance.
Step 4: Choose an Amazon Machine Image (AMI)
- You'll be presented with a list of AMIs. Select an AMI based on your needs. For beginners, the “Amazon Linux 2 AMI” or “Ubuntu Server” are good options.
Step 5: Select an Instance Type
- Choose an instance type. The
t2.micro
instance type is a good start, especially if you are eligible for the free tier. - Click “Next: Configure Instance Details”.
Step 6: Configure Instance Details
- Set the number of instances, network, and subnet settings. You can leave these as default for now.
- Click “Next: Add Storage”.
Step 7: Add Storage
- Adjust the size of the storage if needed. For basic usage, the default size should suffice.
- Click “Next: Add Tags”.
Step 8: Add Tags
- Tags are key-value pairs for resource identification and management. You can add a Name tag with a value like "MyFirstInstance".
- Click “Next: Configure Security Group”.
Step 9: Configure a Security Group
- A security group acts as a virtual firewall. Create a new security group and define rules. For example, allow SSH (port 22) for Linux instances or RDP (port 3389) for Windows.
- Click “Review and Launch”.
Step 10: Review and Launch
- Review your instance configuration. Make sure everything is set up as desired.
- Click “Launch”.
Step 11: Create a Key Pair
- A dialog box will prompt you to create a key pair. Select “Create a new key pair”, name it, and download it to your machine. Note: Store this key safely; you'll need it to access the instance.
Step 12: Access Your Instance
- Once the instance state is “running”, you can connect to it.
- For Linux instances, use an SSH client with your downloaded key. For Windows, use the key for RDP access.
Conclusion
Congratulations! You have successfully launched your first AWS EC2 instance. This instance serves as a foundation for hosting applications, running servers, or for learning more about AWS services. Remember to stop or terminate your instance if you're not using it to avoid unnecessary charges.