This Guidance helps you safeguard and protect your cloud environment by monitoring the security posture of running containers. As a security best practice, you should scan container images for security vulnerabilities, such as common vulnerability exposures (CVEs), before deploying them on container orchestration platforms. This Guidance helps you detect vulnerabilities, such as containers that were initially deployed without proper scanning or containers using expired container images. You can then configure customized actions against such findings to remediate issues.
Architecture Diagram
Step 1
Deploy the AWS Cloud Development Kit (AWS CDK) and AWS CloudFormation template that implements this reference architecture.
Step 2
As part of the implementation, you must configure Amazon Elastic Container Registry (Amazon ECR) for enhanced scanning by Amazon Inspector.
Step 3
Configure the duration that Amazon Inspector should continuously scan the container images in Amazon ECR.
Step 4
Amazon Inspector continuously scans the images in Amazon ECR.
Step 5
Whenever Amazon Inspector finds a new vulnerability, it sends an event to Amazon EventBridge.
Step 6
The EventBridge rule invokes an AWS Lambda function if the event matches the rule.
Step 7
The Lambda function communicates with Amazon Elastic Kubernetes Service (Amazon EKS) or Amazon Elastic Container Service (Amazon ECS) to get a list of running containers and their corresponding container images.
Step 8
The Lambda function checks to see if the vulnerability reported is applicable to any of the running containers. If so, it writes a suitable log message to Amazon CloudWatch about the container(s) impacted by the new vulnerability.
Step 9
A CloudWatch subscription filter invokes a Lambda function to take corrective action.
Well-Architected Pillars
The AWS Well-Architected Framework helps you understand the pros and cons of the decisions you make when building systems in the cloud. The six pillars of the Framework allow you to learn architectural best practices for designing and operating reliable, secure, efficient, cost-effective, and sustainable systems. Using the AWS Well-Architected Tool, available at no charge in the AWS Management Console, you can review your workloads against these best practices by answering a set of questions for each pillar.
The architecture diagram above is an example of a Solution created with Well-Architected best practices in mind. To be fully Well-Architected, you should follow as many Well-Architected best practices as possible.
-
Operational Excellence
The Lambda function logs information about vulnerable containers to CloudWatch. This helps you detect the presence of vulnerabilities in the images of running containers so you can resolve vulnerabilities before they become threats to system security.
-
Security
You should create customer-managed policies for the Lambda function execution roles following the principle of least privilege access. Least privilege access means that users are granted the minimum amount of permissions required to perform their functions.
-
Reliability
This Guidance implements a reliable architecture by using serverless technology, such as Lambda. Additionally, services such as EventBridge and CloudWatch enable loose coupling. Loose coupling breaks down dependencies between components so that potential failures are isolated to only one component.
-
Performance Efficiency
Amazon Inspector is purpose built for vulnerability scanning. This Guidance uses highly scalable, managed services such as Lambda and EventBridge to maintain efficiency, even when workload demand increases.
-
Cost Optimization
With Amazon Inspector—one of the key services in this architecture—you pay only for what you use with no minimum fees and no upfront commitments.
-
Sustainability
This Guidance uses serverless services, such as Lambda, and event-driven services, such as EventBridge, to scale and continually match workload demands, helping you to use only the minimum resources required.
Implementation Resources
A detailed guide is provided to experiment and use within your AWS account. Each stage of building the Guidance, including deployment, usage, and cleanup, is examined to prepare it for deployment.
The sample code is a starting point. It is industry validated, prescriptive but not definitive, and a peek under the hood to help you begin.
Related Content
[Title]
Disclaimer
The sample code; software libraries; command line tools; proofs of concept; templates; or other related technology (including any of the foregoing that are provided by our personnel) is provided to you as AWS Content under the AWS Customer Agreement, or the relevant written agreement between you and AWS (whichever applies). You should not use this AWS Content in your production accounts, or on production or other critical data. You are responsible for testing, securing, and optimizing the AWS Content, such as sample code, as appropriate for production grade use based on your specific quality control practices and standards. Deploying AWS Content may incur AWS charges for creating or using AWS chargeable resources, such as running Amazon EC2 instances or using Amazon S3 storage.
References to third-party services or organizations in this Guidance do not imply an endorsement, sponsorship, or affiliation between Amazon or AWS and the third party. Guidance from AWS is a technical starting point, and you can customize your integration with third-party services when you deploy the architecture.