DEV Community

Chimdi Uche Eni
Chimdi Uche Eni

Posted on

Beginner's Journey: How I Launched an EC2 Instance for the First Time.

Launching your cloud server might sound complex, but with AWS EC2, it’s surprisingly straightforward. In this article, I’ll walk you through how I set up my very first virtual machine using a t2.micro instance. Whether you’re just getting started with DevOps or exploring cloud infrastructure for the first time, this beginner-friendly guide will help you take that first step with no overwhelm.

Before we begin, ensure you have the following ready:

Image description

Already have an account? Log in to your AWS root account to get started.

  1. Create an EC2 Instance: In the AWS Management Console, use the search bar to find EC2, then click “Launch Instance” to begin setting up your virtual server. Image description

To get your EC2 instance up and running, complete the following steps:
a. Enter a name for your instance (e.g., my_happy_instance).
Note: Avoid using spaces in the instance name stick to underscores or hyphens instead

Image description

b. Select an operating system: For this beginner-level setup, we’ll be using Amazon Linux — a lightweight, secure, and AWS-optimized OS that’s perfect for getting started.

Image description

c. Choose an instance type: For this article and basic testing, select t2.micro, which is free-tier eligible and ideal for beginners experimenting with AWS.

Image description

d. Create a key pair: Key pairs are essential for securely connecting to your EC2 instance. You can either select an existing key pair (if you’ve previously created one) or generate a new key pair. Be sure to download and store it securely.

Image description

Image description

e. Configure your security group: For this tutorial, create a new security group and enable the following inbound rule:
SSH (port 22): Allow access from anywhere (0.0.0.0/0) to connect to your instance via the internet.

Image description
⚠️ Note: Allowing SSH from anywhere is fine for testing, but for production environments, it's best to restrict access to specific IP addresses for security.

f. Review your settings, then click “Launch Instance” to create and deploy your EC2 virtual machine.

  • Download Git Bash: If you're using Windows, download and install Git Bash, a terminal tool that allows you to run Linux commands and securely connect to your EC2 instance using SSH
  1. Navigate to your key pair location: Make sure you change into the directory where your key pair was downloaded.

Image description

  • Update the file permissions to secure the key

Image description

  • Connect to your instance using the following SSH command: Go back to the EC2 dashboard and copy your instance’s public IPv4 address. You’ll need this IP to connect to your instance via SSH in Git Bash

Image description
When prompted during your first SSH connection, type yes and press Enter. This confirms the connection and adds your instance to the list of known hosts.

  • You’ll see a terminal prompt that looks something like this: that means you're now logged in and ready to interact with your instance Image description

Let’s run a small, satisfying command just to make sure your EC2 instance is up and responding.

  • Create a File: To verify that your EC2 instance is working as expected, we’ll start by creating a simple text file.

Image description

  • Read the File: Let’s take a peek inside the file we just created just to make sure the magic happened.

Image description
**

🎉Boom! You just ran your first command on the cloud🎉

**
🎉And that’s it!!!. You just launched your first EC2 instance and ran your first cloud command! It might’ve seemed complex at first, but now you’ve taken a solid step into the world of cloud computing.

Top comments (0)