Day 2 - Setting Up a Basic EC2 Instance on AWS

Day 2 - Setting Up a Basic EC2 Instance on AWS

Introduction

In today's post, we'll dive into the foundational AWS service, EC2 (Elastic Compute Cloud). EC2 allows you to launch virtual servers—known as instances—on the cloud. We'll walk through the steps to set up your first EC2 instance and access it.

Prerequisites

Before we begin, make sure you have:

  • An AWS account (if not, refer to Day 1 Click here for instructions on creating one).

  • Basic familiarity with the AWS Management Console.

Steps to Set Up an EC2 Instance

  1. Log in to AWS Management Console

  2. Navigate to EC2 Dashboard

    • In the AWS Management Console, find and select the EC2 service from the list of available services.
  3. Launch Instance

    • Click on the "Launch Instance" button to start the instance creation process.

  4. Choose an Amazon Machine Image (AMI)

    • Select an AMI that suits your needs. For beginners, you can choose a free-tier eligible AMI like Amazon Linux or Ubuntu.

  5. Choose an Instance Type

    • Select the instance type based on your application requirements

      (e.g., t2.micro for free-tier eligible instances).

  6. Configure Instance Details

    • Configure instance details such as network settings, subnet, IAM role

      (if needed), etc. Leave the default settings for now if you're unsure.

  7. Add Storage

    • Specify the storage requirements for your instance. The default configuration includes a root EBS (Elastic Block Store) volume. Adjust size and type as necessary.
  8. Add Tags (Optional)

    • Optionally, add tags to your instance for easier identification and organization.
  9. Configure Security Group

    • Create a new security group or select an existing one. Configure inbound and outbound rules to control traffic to your instance.
  10. Review and Launch

    • Review your instance configuration. Make sure everything looks good before launching the instance.
  11. Launch Instance

    • Click on the "Launch" button. A prompt will ask you to select or create a key pair. Create a new key pair and download the private key file (.pem). This key pair is crucial for accessing your instance securely.
  12. Access Your Instance

    • Once launched, you can see your instance in the EC2 dashboard. Note down the Public DNS or IP address of your instance.

    • Use SSH (Secure Shell) to connect to your instance from your local machine:

        ssh -i /path/to/your-key.pem ec2-user@your-instance-public-dns-or-ip
      

      Replace /path/to/your-key.pem with the path to your downloaded private key file and ec2-user with the appropriate user for your AMI.

Conclusion

Congratulations you have successfully launched your first EC2 instance on AWS. In this post, we covered the essential steps from AMI selection to instance launch and access. Stay tuned for more AWS tutorials and tips in our series.