AWS Builder Center

AWS VPC Flow Logs: Monitor Network Traffic and Detect Suspicious Activity Beginner friendly AWS Security

Learn how AWS VPC Flow Logs help monitor network traffic, identify unusual communication patterns, troubleshoot connectivity issues, and improve cloud security. This article explains how Flow Logs work, their benefits, and how beginners can use them for network monitoring.

Introduction

When managing cloud infrastructure, security is not only about protecting servers from external attacks. It is also important to control how administrators access those servers.
Traditionally, developers and administrators connect to Amazon EC2 instances using SSH (Secure Shell) or RDP (Remote Desktop Protocol). This often requires opening inbound ports and managing authentication keys.
But what if we could access an EC2 instance without opening SSH port 22?
AWS provides a solution called AWS Systems Manager Session Manager.
In this article, we will understand how Session Manager works, why it is useful, and how it helps improve cloud security.

1. What is AWS Systems Manager Session Manager?

AWS Systems Manager Session Manager is a feature that allows administrators to securely access and manage EC2 instances through the AWS Management Console or AWS CLI.
It provides interactive access without requiring inbound SSH or RDP ports to be opened.
Some important benefits include:
  • No requirement for inbound SSH port 22 for standard sessions.
  • No need to maintain SSH keys for standard sessions.
  • Centralized access control using IAM.
  • Support for private EC2 instances.
  • Session activity logging options.

2. How Does Session Manager Work?

Session Manager uses an agent called the AWS Systems Manager Agent (SSM Agent).
The agent runs on the EC2 instance and communicates with AWS Systems Manager.
The basic communication flow is:
Administrator
|
v
AWS Management
Console
|
v
AWS Systems Manager
|
v
Session Manager
|
v
SSM Agent
|
v
EC2 Instance
The administrator requests a session through AWS. Systems Manager communicates with the agent on the managed instance to establish the session.
This approach does not require an inbound SSH connection from the administrator's computer.

3. Traditional SSH vs Session Manager

Let's compare the two approaches.
Feature
Traditional SSH
Session Manager
Port 22 inbound
Usually required
Not required
SSH key management
Commonly required
Not required for standard sessions
Public IP
Sometimes required
Not inherently required
IAM integration
Additional configuration
Native
Session logging
Separate configuration
Supported
Browser access
No
Yes
Session Manager provides an alternative for organizations that want centralized and controlled server access.

4. Requirements for Using Session Manager

Before using Session Manager, we need:
  1. An active AWS account.
  1. An Amazon EC2 instance.
  1. SSM Agent installed and running on the instance.
  1. An appropriate IAM instance role with Systems Manager permissions.
  1. Outbound HTTPS connectivity to the required Systems Manager endpoints.
For instances in private subnets without internet access, suitable VPC interface endpoints can provide private connectivity to Systems Manager.

5. Practical Implementation

Let's understand how to connect to an EC2 instance using Session Manager.
Step 1: Launch an EC2 instance
  • Open the AWS Management Console.
  • Navigate to Amazon EC2.
  • Launch a Linux EC2 instance.
  • Select an appropriate instance type.
  • Configure its network settings.
Step 2: Configure IAM permissions
Create or attach an IAM role that provides the required Systems Manager permissions to the EC2 instance.
Use the principle of least privilege.
Step 3: Verify SSM Agent
Ensure that SSM Agent is installed and running on the EC2 instance.
Step 4: Open Session Manager
  • Navigate to AWS Systems Manager.
  • Select Session Manager.
  • Open the Start Session option.
  • Select your managed EC2 instance.
  • Start the session.
Step 5: Execute commands
After connecting, you can execute Linux commands such as:
whoami
hostname
pwd
ls
These commands help verify that the session is working correctly.

6. Security Best Practices

To improve security when using Session Manager, follow these practices:
  • Apply least-privilege IAM policies.
  • Allow only authorized users to start sessions.
  • Enable session logging where appropriate.
  • Configure session timeouts.
  • Keep SSM Agent updated.
  • Use encryption for session data where required.
  • Monitor administrative activity using AWS CloudTrail.
  • Avoid giving every administrator unrestricted access to production servers.

7. Real-World Use Case

Imagine an organization hosting a web application on EC2 instances inside a private subnet.
The development team needs to troubleshoot application errors.
Using traditional SSH, administrators may need additional network access configuration or a bastion host.
With Session Manager, authorized administrators can access managed instances through AWS Systems Manager without exposing inbound SSH ports.
This reduces network exposure and simplifies administrative access.

8. Conclusion

AWS Systems Manager Session Manager is a useful service for securely managing cloud infrastructure.
It provides centralized access control, reduces the need for exposed administrative ports, and supports session logging.
For beginners learning AWS security, understanding Session Manager is an important step toward building secure cloud architectures.
Remember: Good cloud security is not just about protecting infrastructure. It is also about controlling who can access it and monitoring what they do.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article