Table of Contents
ToggleIntroduction.
In today’s cloud-first world, security is no longer an afterthought—it’s a fundamental requirement. As more businesses migrate workloads to Amazon EC2, maintaining a secure and compliant infrastructure becomes both more essential and more complex. That’s where Amazon Inspector 2 steps in. Designed as a next-generation vulnerability management tool, Inspector 2 allows you to continuously scan your Amazon EC2 instances for software vulnerabilities and unintended network exposure, helping you identify risks before attackers do.
Gone are the days when vulnerability scanning required extensive setup, third-party tools, and manual intervention. With Amazon Inspector 2, AWS has reimagined cloud-native vulnerability detection by providing seamless integration, automation, and deep visibility across your EC2 environments. Whether you’re a DevOps engineer looking to harden infrastructure, a security analyst tracking CVEs, or a cloud architect designing compliant systems, Amazon Inspector 2 offers powerful tools at your fingertips.
This guide walks you step-by-step through setting up and using Amazon Inspector 2 to scan your EC2 instances for vulnerabilities. We’ll start with the prerequisites, including IAM permissions, supported OS types, and the required AWS services that need to be enabled. From there, you’ll learn how to activate Inspector 2, attach necessary roles to your EC2 instance, verify that the agent is installed and operational, and initiate a scan.
You’ll also learn how Amazon Inspector automatically integrates with AWS Systems Manager to deploy and manage the Inspector Agent. This means zero hassle in managing agents manually—Inspector handles it all in the background. Once scans begin, you’ll discover how to interpret the findings, understand the severity of each vulnerability, and take the recommended remediation actions.
Amazon Inspector 2 provides rich metadata with each finding, including the affected package, CVE identifier, CVSS score, and remediation suggestions. This enables security teams to prioritize patching based on real risk and compliance needs. The findings can also be integrated into your security workflow using AWS services like Security Hub, EventBridge, and CloudWatch.
Security isn’t just about finding vulnerabilities—it’s about fixing them fast. And with continuous scanning enabled, Amazon Inspector 2 will monitor your EC2 instances in real-time, re-evaluating them as changes occur. This ensures that your infrastructure remains secure even as applications are updated, new packages are installed, or configurations evolve.
By the end of this guide, you’ll have a fully operational vulnerability scanning pipeline for your EC2 instances using Amazon Inspector 2, and the confidence that comes with knowing your workloads are being monitored for risks 24/7. Whether you’re securing a small web server or a fleet of production instances, this guide will help you build a stronger, safer AWS environment.
Let’s dive in and secure your EC2 instances—step by step.
Step-by-Step: Using Amazon Inspector 2 for EC2 Vulnerability Scanning
1. Prerequisites
- Ensure Amazon Inspector is enabled in your AWS region.
- Your EC2 instance must use Amazon Inspector-supported OS (Amazon Linux, Ubuntu, Red Hat, etc.).
- Instance must have the SSM Agent installed and running.
- The EC2 instance must be configured with:
- An IAM role allowing SSM and Inspector actions.
- Access to the internet or VPC endpoints for SSM and Inspector.
2. Enable Amazon Inspector
You can do this in the AWS Management Console:
- Go to Amazon Inspector in the AWS Console.
- Click “Enable Inspector”.
- It will auto-discover EC2 instances and container images for scanning.


Alternatively, use the CLI:
aws inspector2 enable
3. Attach Required IAM Role to EC2
Make sure the EC2 instance has an IAM role with the following managed policies:
AmazonSSMManagedInstanceCore
AmazonInspector2ManagedAgentPolicy
(automatically attached when enabling Inspector)





4. Wait for the Agent to be Installed
Once enabled, Amazon Inspector will automatically install the Inspector Agent via SSM.
You can confirm by checking:
sudo systemctl status inspector
Or in the Inspector Console > Account Management > Managed Instances.
5. Start Scanning
Amazon Inspector starts scanning automatically once the agent is running.
It performs:
- EC2 vulnerability scanning
- Network reachability analysis
- Software inventory analysis
6. View Findings
Go to the Amazon Inspector Console:
- Navigate to Findings.
- Filter by resource type: EC2 instance.
- You’ll see vulnerabilities (CVEs) ranked by severity (Critical, High, Medium, etc.).
You can also use the CLI:
aws inspector2 list-findings --filters '{"resourceType":["EC2_INSTANCE"]}'
7. Remediate Issues
Each finding includes:
- A CVE identifier
- A description of the vulnerability
- A list of affected packages
- Recommended remediation steps (e.g., update a package)
You can patch using:
sudo yum update # For Amazon Linux, Red Hat
sudo apt update && sudo apt upgrade # For Ubuntu
Optional: Enable Continuous Scanning
Inspector 2 supports continuous scanning—so any changes (like new packages or OS versions) get rescanned automatically.
Conclusion.
Securing your Amazon EC2 instances doesn’t have to be complicated or time-consuming—and with Amazon Inspector 2, it isn’t. This powerful, cloud-native service takes the heavy lifting out of vulnerability management by offering automated, continuous scanning that integrates directly with your existing AWS infrastructure. From discovering EC2 instances, deploying agents, detecting vulnerabilities, and providing remediation guidance—all the way to tracking findings and prioritizing threats—Inspector 2 delivers a streamlined, security-first experience.
By following this step-by-step guide, you’ve learned how to:
- Enable Amazon Inspector 2 in your AWS account,
- Ensure your EC2 instances are properly configured and agent-ready,
- Interpret vulnerability findings, and
- Take actionable steps to patch and protect your environments.
The beauty of Inspector 2 lies in its simplicity, scalability, and real-time visibility. Whether you’re managing a single EC2 instance or hundreds across multiple regions, this tool helps you maintain compliance, reduce attack surfaces, and stay ahead of evolving threats.
Remember, cloud security is not a one-time task—it’s a continuous process. But with tools like Amazon Inspector 2 in your toolkit, staying secure becomes much more manageable.
Now that you’ve got the foundation in place, consider integrating Inspector findings into your CI/CD pipeline, security dashboards, or alerting systems for even more automation and insight.
Stay secure, stay proactive—and let AWS Inspector 2 keep watch while you build.