Exploring AWS EC2: Instance Setup and Security Group Configuration

Exploring AWS EC2: Instance Setup and Security Group Configuration

Hello Network!🌸

Recently, I dabbled in cloud computing through an interactive exercise at AltSchool Africa using an Infrastructure-as-a-Service (IaaS) platform.

IaaS provides access to scalable, cost-effective, and secure computing resources such as virtual machines, storage, networking, databases, and load balancers.

For this exercise, I explored Amazon Web Services (AWS) and worked with Elastic Compute Cloud (EC2), creating instances and security groups.

An instance is a virtual computer that runs in the cloud. EC2 allows users to have virtual servers for various applications, from small test environments to enterprise-level deployments.

A security group acts as a virtual firewall that controls inbound and outbound traffic to an instance based on defined rules.

Before I could start setting up my EC2 instance, I encountered an interesting feature—AWS partitions accounts.

My AWS Skill Builder account, which I use to access AWS learning materials, could not be used to log in to the AWS Management Console.

Instead, I had to create an AWS Identity and Access Management (IAM) account for this exercise.

AWS's partitioning feature enhances security by preventing unauthorized access, protecting data, controlling costs, and reducing accidental security risks by keeping infrastructure accounts separate from other accounts.

Now, to the exercise. The main goal was to create two EC2 instances—one allowing SSH access and the other denying it—to explore security configurations in cloud environments.

Article content

SSH (Secure Shell) is a network protocol that allows secure remote access and management of devices over an encrypted connection.

This exercise is useful for scenarios where administrators need controlled remote access to critical systems while keeping certain instances isolated for security purposes.

To achieve this, I created the instances, configured their instance types and Amazon Machine Image (AMI), generated key pairs in both .pem (Privacy-Enhanced Mail) and .ppk (PuTTY Private Key) formats, created security groups with specific inbound and outbound rules, assigned them to their respective instances, and accessed the instances via SSH clients.

Article content
I created two Instances in EC2

The Amazon Machine Image (AMI) serves as a preconfigured blueprint for virtual machines, containing the necessary components such as the operating system and server configurations.

AWS provides both public and private AMIs, depending on the intended use. For this setup, I used the Amazon Linux 2 AMI, a publicly managed AMI by AWS.

The key pair, consisting of a public and private key, ensures secure access and authentication via SSH.

For the first security group, I:

  • Allowed SSH in the inbound rule by selecting the SSH type, which is automatically set to TCP port 22.
  • Restricted access to my IP address only for security purposes.
  • Left the outbound rule as default to allow external access for updates and API requests.

For the second security group, I:

  • Did not configure inbound or outbound rules, effectively blocking all connections, including SSH.

Upon launching the first instance, I noticed it was automatically assigned a “launch wizard” security group. This is a default security group AWS creates when an instance is launched. Since its rules interfered with my custom security group, I temporarily removed it and assigned my own security group.

Article content
I created two Security Groups: one allowing SSH & one denying SSH

To test the security configurations, I accessed the instances using SSH clients, including Git Bash and PuTTY.

Using Git Bash, I connected to the first instance with the .pem private key following the SSH commands provided in the AWS EC2 interface. Since no errors were generated, it confirmed that my private key was secure, and I could successfully connect.

When I attempted to connect to the second instance using its private key, the SSH connection timed out. This confirmed that the security group effectively blocked SSH access.

Testing access via PuTTY: Since PuTTY requires .ppk keys, I used PuTTYgen to convert the .pem file to .ppk format and set up a passphrase for added security. After loading the .ppk key, I successfully connected to the first instance, while the second instance remained inaccessible, verifying the security configurations.

Article content
PuTTY SSH connection successful verifying first security group configuration
Article content
PuTTY SSH connection to port 22 denied verifying second security group configuration

After completing the exercise, I terminated the instances to prevent unnecessary resource consumption and avoid AWS charges.

Article content
I terminated the instances I created

Through this process, I learnt that SSH should only be allowed when necessary, such as for administrative access, troubleshooting, or secure remote management. Additionally, access should always be restricted to specific IP addresses or internal networks to reduce security risks.

Many thanks to Victor Akinode for his guidance on this setup. This experience has given me a deeper understanding of cloud security and infrastructure management.

Till next time,

Chinwendu.

Ebenezer Okunuga, DCP.

I help you reduce fraud and mitigate risk through data-driven solutions | Payments & Risk Manager | Fraud Prevention → KYC Compliance → Transaction Analysis

1mo

This was very insightful, Thank you, Chi.

Like
Reply
Evalyne Njoroge

Passionate About Networks | Collaborative Problem Solver | Technical Support | Exploring, Breaking, and Building Better Networks

1mo

👏👏 A lot of insights. Keep going

Obi Sammy

Software Engineer targeting MongoDB || Express || React || Node opportunities

1mo

It's a fantastic resource for anyone looking to explore create EC2 instances

Temitayo Olaiya

Cloud Support Engineer || Enterprise Security || IT Operations || IAM|| Application Support || Technical Support || Networking || Kubernetes || Cross-Border Payment || Python Developer

1mo

Good move Chinwendu

To view or add a comment, sign in

More articles by Chinwendu Ike

  • Networking Diaries #010

    Networking Diaries #010

    Hello Network!🌸 The journey continues with another entry in the Networking Diaries! Week 10 of The NetClan LiNE…

    6 Comments
  • Networking Diaries #009

    Networking Diaries #009

    Hello Network!🌸 It’s time for another recap from my journey through The NetClan LiNE programme. In this entry of the…

  • Networking Diaries #008

    Networking Diaries #008

    Hello Network!🌸 In this entry of the Networking Diaries, I'm talking Protocols. Recapping what I learnt in Week 8 of…

    4 Comments
  • Networking Diaries #007

    Networking Diaries #007

    Hello Network!🌸 It’s been a while since I logged an entry into the Networking Diaries..

    10 Comments
  • Networking Diaries #006

    Networking Diaries #006

    Hello, Network!🌸 A new phase at The NetClan LiNE program means another entry in the Networking Diaries. In this one…

    4 Comments
  • Networking Diaries #005

    Networking Diaries #005

    Hello Network!🌸 Here again with another entry in the Networking Diaries!—this time, I'm reflecting on week 5 of The…

    6 Comments
  • Networking Diaries #004

    Networking Diaries #004

    Hello Network!🌸 Welcome to the fourth entry of the Networking Diaries! I’m really enjoying this—recapping what I’ve…

    2 Comments
  • Networking Diaries #003

    Networking Diaries #003

    Hello Network!🌸 Another day, another entry in the Networking Diaries! :) Today, I’m recapping week 3 of my journey in…

  • Networking Diaries #002

    Networking Diaries #002

    Hello, Network!🌸 Back again with another entry in the Networking Diaries! So there’s something I forgot to mention in…

    11 Comments
  • Networking Diaries #001

    Networking Diaries #001

    Hello Network!🌸 One of the best things you can do for yourself is document your journey. It’s a way to track progress,…

    10 Comments

Insights from the community

Others also viewed

Explore topics