Project 07: Building a Cloud-Based SOC Lab
CyberPreacher Edition
Project scenario
In this project, you will build a simulated SOC (Security Operations Center) environment in AWS, deliberately leaving an EC2 instance vulnerable to observe real-world attack traffic. Logs will be ingested into Amazon CloudWatch and analyzed using Amazon Athena, including geolocation mapping of attacker IPs.
All resources will be created in a region close to your location. Ensure consistency across your AWS account, VPC, and region.
Lab objectives
In this lab, you will complete the following exercises:
- Exercise 1: Create a VPC and Subnet
- Exercise 2: Launch and Configure an EC2 Instance
- Exercise 3: Configure Security Groups and Disable Firewall
- Exercise 4: Simulate Attacks and Analyze Logs
- Exercise 5: Set Up CloudWatch Logs and Query with Visualization
Instructions
Exercise 1: Create a VPC and Subnet
Estimated timing: 10 minutes
In this exercise, you will:
- Task 1: Create a VPC named VPC-SOCLab
- Task 2: Create a public subnet named Subnet-SOCLab
Task 1: Create a VPC
- Open the AWS Management Console and log in.
- Navigate to the VPC Dashboard.
- Click Create VPC and configure the following:
- Name tag: Enter
VPC-SOCLab
.
- IPv4 CIDR block: Enter
192.168.0.0/16
.
- Leave other settings as default.
- Click Create VPC.
Task 2: Create a Public Subnet
- In the VPC Dashboard, select Subnets and click Create subnet.
- Configure the following:
- Name tag: Enter
Subnet-SOCLab
.
- VPC ID: Select
VPC-SOCLab
.
- Availability Zone: Select a zone in your region (e.g.,
us-east-1a
).
- IPv4 CIDR block: Enter
192.168.10.0/24
.
-
Click Create subnet.
- Enable auto-assign public IP for the subnet:
- Select the subnet and click Actions > Edit Subnet Settings.
- Enable Auto-assign public IPv4 address and save changes.
Result: A VPC and public subnet are created successfully.
Estimated timing: 15 minutes
In this exercise, you will:
- Task 1: Launch an EC2 instance named TI-NET-EAST-1
- Task 2: Assign CloudWatch IAM role to new Instance.
Task 1: Launch an EC2 Instance
- Open the AWS Management Console and navigate to the EC2 Dashboard.
- Click Launch Instances and configure the following:
- Name: Enter
TI-NET-EAST-1
.
- AMI: Select Microsoft Windows Server 2019 Base.
- Instance type: Select t2.micro (eligible for free tier).
- Key pair: Create or select an existing key pair.
- Network settings:
- VPC: Select
VPC-SOCLab
.
- Subnet: Select
Subnet-SOCLab-Public
. (Ensure you select the public subnet)
- Auto-assign public IP: Disabled.
- Security group: Create a new security group with the following rule:
- Type: RDP
- Source: Anywhere (0.0.0.0/0).
-
Click Launch Instance.
- Once the instance is running, note the public IP address.
Result: A Windows Server EC2 instance is deployed successfully.
Task 2: Assign CloudWatch IAM Role to New Instance
- Create an IAM Role:
- Open the IAM Dashboard in the AWS Management Console.
- Navigate to Roles and click Create role.
- Select AWS service as the trusted entity type.
- Choose EC2 as the use case and click Next.
- Attach Permissions:
- Search for and select the policy CloudWatchAgentServerPolicy.
- Click Next and provide a name for the role, e.g.,
CloudWatchAgentRole
.
- Review the settings and click Create role.
- Assign the Role to the EC2 Instance:
- Navigate to the EC2 Dashboard and select the instance
TI-NET-EAST-1
.
- Click Actions > Security > Modify IAM role.
- Select the role
CloudWatchAgentRole
from the dropdown and click Update IAM role.
Result: The EC2 instance is now configured with the IAM role required for CloudWatch integration.
Estimated timing: 10 minutes
In this exercise, you will:
- Task 1: Modify the security group to allow all inbound traffic
- Task 2: Disable the Windows Firewall
Task 1: Modify the Security Group
- In the EC2 Dashboard, select Security Groups.
- Locate the security group associated with
TI-NET-EAST-1
.
- Edit the inbound rules and add the following rule:
- Type: All traffic
- Source: Anywhere (0.0.0.0/0).
- Save the changes.
Task 2: Disable the Windows Firewall
- Connect to the EC2 instance using RDP.
- Log in with the credentials you set during instance creation.
- Open the Run dialog (
Win + R
), type wf.msc
, and press Enter.
- In the Windows Defender Firewall with Advanced Security window:
- For each profile (Domain, Private, and Public), set Firewall state to Off.
- Save the changes and close the window.
Result: The EC2 instance is fully exposed to incoming traffic.
Exercise 4: Simulate Attacks and Analyze Logs
Estimated timing: 10 minutes
In this exercise, you will:
- Task 1: Simulate failed login attempts
- Task 2: Analyze logs in the Windows Event Viewer
Task 1: Simulate Failed Login Attempts
- Use an RDP client to attempt logging into the EC2 instance with incorrect credentials.
- Repeat the process multiple times to generate failed login events.
Task 2: Analyze Logs
- Log in to the EC2 instance using the correct credentials.
- Open the Event Viewer and navigate to:
- Filter logs by Event ID 4625 to view failed login attempts.
Result: Failed login attempts are logged in the EC2 instance.
Exercise 5: Set Up CloudWatch Logs and Query with Visualization
Estimated timing: 20 minutes
In this exercise, you will:
- Task 1: Create a CloudWatch log group
- Task 2: Install the CloudWatch agent on the EC2 instance
- Task 3: Query logs using Amazon Athena
Task 1: Create a CloudWatch Log Group
- Open the CloudWatch Dashboard and navigate to Log groups.
- Click Create log group and name it
SOC-Logs
.
- Open the new log group SOC-Logs, and create a new log stream windows.
Task 2: Install the CloudWatch Agent
- Download and install the CloudWatch agent on the EC2 instance.
-
Configure the agent to send Windows Event Logs to the SOC-Logs
log group.
- Download the CloudWatch Agent:
- Connect to the EC2 instance using RDP.
- Open a web browser and download the CloudWatch agent from the AWS CloudWatch Agent Downloads.
- Select the appropriate version for Windows and save the installer.
- Install the CloudWatch Agent:
- Run the downloaded installer and follow the on-screen instructions to complete the installation.
- Configure the CloudWatch Agent:
- Follow the prompts to configure the agent to send Windows Event Logs to CloudWatch.
- Start the CloudWatch Agent:
- Verify Log Ingestion:
- Open the CloudWatch Dashboard in the AWS Management Console.
- Navigate to Log groups and confirm that logs are being sent to the
SOC-Logs
log group.
Result: The CloudWatch agent is installed and configured to send logs to CloudWatch.
Task 3: Query Logs Using Logs Insight
- Open the Logs Insights and set up a query table for the CloudWatch logs.
- Run a query to analyze failed login attempts.
- Visualize the output of the failed login by IP address.
Task 3: Query Logs Using Logs Insight
- Open Logs Insights:
- Navigate to the CloudWatch Dashboard in the AWS Management Console.
- Select Log groups and click on
SOC-Logs
.
- Click View in Logs Insights.
- Set Up a Query:
- In the query editor, enter the following query to filter failed login attempts:
fields @timestamp, @message
| filter @message like /4625/
| sort @timestamp desc
| limit 20
- Click Run query to execute the query.
- Analyze Results:
- Review the query results to identify failed login attempts.
- Note the IP addresses and timestamps associated with the events.
- Visualize Data:
- Modify the query to group failed login attempts by IP address:
```sql
fields @timestamp, @message
| filter @message like /4625/
| parse @message /Source Network Address:\s+(?\S+)/
| stats count(*) as failedLogins by sourceIP, bin(1h)
| sort failedLogins desc
- Click **Run query** to generate a visualization.
```sql
fields @timestamp, @message
| filter @message like /4625/
| parse @message /Source Network Address:\s+(?<sourceIP>\S+)/
| stats count(*) as failedLogins by sourceIP, bin(1h)
| sort failedLogins desc
- Export Insights:
- Save the query results or export them for further analysis.
- Optionally, create a dashboard in CloudWatch to monitor failed login attempts over time.
Result: Logs are queried and visualized to identify patterns in failed login attempts.
Summary of Key Security Practices
- Visibility: Monitoring failed login attempts via Event ID
- Threat Intelligence: Mapping attacker IPs to real-world locations
- Logging: Logs are ingested into CloudWatch for analysis
- Awareness: Open exposure attracts real adversaries and illustrates global attack patterns
Note: Delete all resources once the project is completed to prevent unnecessary charges.
Side Task: Share screenshots on LinkedIn showing attack visualization and include hashtags #cloudprojectwithcyberpreacher and #CPwCP. Share your experience and learnings from this SOC lab.