Amazon VPCs and maintaining security in VPCs

Kaldrack
6 min readNov 26, 2023

--

1.Introduction

Amazon Virtual Private Cloud or amazon VPC is a logically isolated virtual network where you can launch your AWS resources such as Amazon EC2 and Amazon RDS instances. VPCs allows users to create virtual private networks complete with custom IP address ranges, subnets and network configurations. For instance, your business can use a VPC to create a fully managed network where you can host your multi-tier web application, enforce security rules on inbound and outbound traffic and manage connectivity between your servers. This level of control and flexibility allows your businesses to architect their infrastructure in a way that resembles your traditional on-premises network but with a benefit of using the highly scalable infrastructure of AWS. However, this power and flexibility brought forth by VPCs calls for the need for a robust well thought-through security measures to ensure proper running of a company’s cloud infrastructure. Security in your VPC is a priority due to the sensitive nature of the data and the applications they house. A well secured VPC offers a resilient, efficient and trust-worthy cloud environment. In turn, it allows companies the confidence to fully leverage the benefits of cloud computing and cloud resources while meeting compliance and regulatory standards. That is why in this article I shall talk about the best practices to maintain to ensure robust security in AWS VPCs.

2.I Network Architecture and Design

When you set up your VPC, you must know which region you want to place it in. VPCs are confined to one region and cannot span multiple regions. You then choose which availability zone you want to place your subnet in and whether the subnet is private or public. When launching your instances, you launch it into a subnet within your VPC. Use your subnets to isolate your tiers I.e. web, application and database. This segmentation enhances security by limiting the scope of potential breaches and limiting lateral movement by attackers. Use private subnets for resources that should not be accessed directly from the internet i.e. databases. Furthermore, you can use AWS private link to connect your AWS resources to AWS services using a private IP addresses as if those services were hosted directly in your VPC. Therefore you do not need to use an internet gateway or a NAT device to access AWS services. By strategically placing resources in different subnets, organizations can control traffic flow and implement granular security policies as illustrated by the image bellow.

2.II Network Security and Control of Traffic.

Network security and effective control of traffic are pertinent measures in maintaining security in the VPCs. Network security can be highly achieved by leveraging mechanisms i.e. security groups, network access control lists and route tables. To begin with, let us look at security groups. Security groups act as virtual firewalls at the instance level controlling inbound and outbound traffic from Amazon EC2 and Amazon RDS instances. They allow organizations to specify rules that filter traffic based on; ports, protocols and source/destination IP addresses. Security groups perform stateful packet filtering and create rules that reference other security groups.

Network access control lists on the other hand operate in the subnet level adding another layer of security. They act as traffic filters for controlling traffic in and out of one or more than one subnets. Network ACLs provide stateless, coarse grain network control, enabling organizations to configure rules that explicitly deny or allow traffic. Hence a more granular control over the network. Also, because Network ACLs apply to the entire subnet, they can be used as defense-in-depth incase an instance is ever launched without the correct security group.

On route tables, you should configure subnet route tables with the minimum network routes to support your network requirements.

The following diagram illustrates the layers of security provided by security groups and Network ACLs. For instance, traffic from an internet gateway is routed to the appropriate subnets using routes from the route table. The rules of the network ACLs associated with the subnet then control which traffic is allowed in the subnet. Security groups associated with the instance furthermore control which traffic is allowed in the instance.

2.III Network security for VPC-to -PC and VPC-to-on-premises traffic flow.

For VPC-to-VPC connectivity, AWS provides AWS Transit Gateway which allows for the centralization of network connections and the consistent implementation of network security among your VPCs. AWS Transit Gateway acts as a hub that controls how traffic is routed among all connected networks, which acts as spokes. When a new VPC is connected into the network, AWS Transit Gateway makes it automatically available to all connected networks. Security groups and network ACLs can be configured to restrict traffic, ensuring that only necessary communication occurs adhering to the principals of least privilege.

On the other hand, for VPC-to-on-premises connectivity, services like AWS Direct connect or AWS site-to-site connections come in play. These channels provide a secure connections over which data can be transmitted from on-premises data centers and AWS VPCs. However, one advantage of AWS direct connect is that your traffic remains on the AWS global network without touching the public internet. This exponentially reduces the chances of hitting bottleneck or increased latency. Furthermore, it is paramount to implement encryption for data in transit and configure security groups and network ACLs for controlled traffic flow. Additionally, AWS CloudHub can be employed for efficiently managing multiple on-premises connections.

2.IV Monitoring, logging and Incident response

Security strategies on VPCs rely heavily on monitoring, logging and incident response. Monitoring tools such as Amazon CloudWatch enable real time observation of VPC resources enabling security teams to detect any anomalies and potential security breaches. VPC logs on the other hand give a detailed record of traffic IP, facilitating in-depth analysis.

Logging on the hand is aided by services such as CloudTrail and CloudWatch Logs. This tools create a comprehensive audit trail of activities within the VPCs aiding in forensic regulations and compliance requirements.

Incident response on the other hand is a critical component that requires a well-defined plan that outlines; roles, communication protocols and escalation procedures. Rapid detection, analysis and response to security incidences are crucial processes and the insights gained from the monitoring and logging process are pertinent in refining the processes and strategies over time.

2.V AWS Network firewall, AWS WAF and AWS Security Hub

AWS network firewall provides an additional layer of defense by allowing the creation of customizable firewall rules which controls traffic flow in and out of the VPC. AWS Web Application Firewall integrates seamlessly with network firewall to provide protection against web layer exploits. Furthermore, you can use AWS Security hub to check for unintended network accessibility from your instances. This synergy creates a strong and comprehensive security posture facilitating integrity and availability of applications and data within the VPC.

3. Conclusion

In conclusion, maintaining security in a VPC is a dynamic undertaking that requires a combination of several processes i.e. strategic design, vigilant monitoring and incident response. Though in this exploration we have talked about some of the best practices, it is important to maintain continuous monitoring, logging and fine-tuning of security strategies in order to match the evolving threats in the landscape. By maintaining security in the VPC, companies can leverage AWS services and resources with assured confidentiality, integrity and availability of their of their critical assets within the VPC.

Below are links to some of the resources for further insight into this topic:

(i) Security best practices for your VPCs

(ii) Infrastructure security in Amazon VPC

--

--