Which network security protocol is used with AWS site

I host my website on an Amazon Elastic Compute Cloud (Amazon EC2) instance. I want users to connect to my website on HTTP (port 80) or HTTPS (port 443). How can I do that?

Resolution

To allow traffic on port 80 and 443, you must configure the associated security group and network access control list (network ACL).

Security group rules

For HTTP traffic, add an inbound rule on port 80 from the source address 0.0.0.0/0.

For HTTPS traffic, add an inbound rule on port 443 from the source address 0.0.0.0/0.

These inbound rules allow traffic from IPv4 addresses. To allow IPv6 traffic, add inbound rules on the same ports from the source address ::/0. For more information on creating or modifying security groups, see Control traffic to resources using security groups.

Security groups are stateful, so the return traffic from the instance to users is allowed automatically. You don't need to modify the security group's outbound rules.

Note: The following example shows the security group rules for allowing IPv4 and IPv6 traffic on TCP port 80 (HTTP) and 443 (HTTPS). Determine if other sources of traffic, such as SSH or RDP to log in to the instance, must be allowed for your use case. Then, make sure that your SG has the relevant inbound rules to allow the needed traffic.

Inbound rules

Network ACL

The default network ACL allows all inbound and outbound IPv4 traffic. If your users connect over IPv6 and your Amazon Virtual Private Cloud (Amazon VPC) has an associated IPv6 CIDR block, then your default network ACL also automatically adds rules allowing all inbound and outbound IPv6 traffic. However, if you use a custom network ACL with more restrictive rules, then you must explicitly allow traffic on port 80 and 443.

Network ACLs are stateless, so you must add both inbound and outbound rules to allow the connection to your website. For more information on modifying network ACL rules, see Control traffic to subnets using Network ACLs.

Note: The following example shows a custom network ACL that allows traffic on TCP port 80 (HTTP) and 443 (HTTPS). Network ACLs are applied to all resources in an entire subnet, not just a single EC2 instance. In the example configuration, all traffic to and from resources in the same subnet is blocked, except on destination port 80 and 443. Determine if other sources of traffic, such as SSH or RDP to log in to the instance, must be allowed for your use case. Then, make sure that you have the relevant inbound rules to allow the needed traffic.

Inbound rules

Troubleshooting a connection refused error

A connection refused error means that the connection request is routed to the instance but isn't received from the service on the specified port. If Host A initiates a TCP connection to Host B and receives a connection refused error, then that error means the following:

  • First, Host A sent a TCP SYN packet to Host B.
  • Then, Host B sent a TCP RST packet in reply to Host A.

If you encounter this error, even after allowing TCP ports 80 and 443 in the Security group and Network ACL, then troubleshoot the following:

  • The service daemon, such as httpd (Apache), isn't running or is in a stopped state.

To troubleshoot, check if the service is in the running state in the EC2 instance.

  • The service is listening on a wrong port.

To troubleshoot, check if the EC2 instance is listening on the required TCP port (80/443).

  • The port is blocked by a firewall.

To troubleshoot, check if an OS-level firewall in the EC2 instance is blocking incoming TCP traffic on the required port.

The configuration for this scenario includes a virtual private cloud (VPC) with a public subnet and a private subnet, and a virtual private gateway to enable communication with your own network over an IPsec VPN tunnel. We recommend this scenario if you want to extend your network into the cloud and also directly access the internet from your VPC. This scenario enables you to run a multi-tiered application with a scalable web front end in a public subnet, and to house your data in a private subnet that is connected to your network by an IPsec AWS Site-to-Site VPN connection.

This scenario can also be optionally configured for IPv6. Instances launched into the subnets can receive IPv6 addresses. We do not support IPv6 communication over a Site-to-Site VPN connection on a virtual private gateway; however, instances in the VPC can communicate with each other via IPv6, and instances in the public subnet can communicate over the internet via IPv6. For more information about IPv4 and IPv6 addressing, see IP addressing.

For information about managing your EC2 instance software, see Managing software on your Linux instance in the Amazon EC2 User Guide for Linux Instances.

Overview

The following diagram shows the key components of the configuration for this scenario.

Which network security protocol is used with AWS site

The configuration for this scenario includes the following:

  • A virtual private cloud (VPC) with a size /16 IPv4 CIDR (example: 10.0.0.0/16). This provides 65,536 private IPv4 addresses.

  • A public subnet with a size /24 IPv4 CIDR (example: 10.0.0.0/24). This provides 256 private IPv4 addresses. A public subnet is a subnet that's associated with a route table that has a route to an internet gateway.

  • A VPN-only subnet with a size /24 IPv4 CIDR (example: 10.0.1.0/24). This provides 256 private IPv4 addresses.

  • An internet gateway. This connects the VPC to the internet and to other AWS products.

  • A Site-to-Site VPN connection between your VPC and your network. The Site-to-Site VPN connection consists of a virtual private gateway located on the Amazon side of the Site-to-Site VPN connection and a customer gateway located on your side of the Site-to-Site VPN connection.

  • Instances with private IPv4 addresses in the subnet range (examples: 10.0.0.5 and 10.0.1.5), which enables the instances to communicate with each other and other instances in the VPC.

  • Instances in the public subnet with Elastic IP addresses (example: 198.51.100.1), which are public IPv4 addresses that enable them to be reached from the internet. The instances can have public IPv4 addresses assigned at launch instead of Elastic IP addresses. Instances in the VPN-only subnet are back-end servers that don't need to accept incoming traffic from the internet, but can send and receive traffic from your network.

  • A custom route table associated with the public subnet. This route table contains an entry that enables instances in the subnet to communicate with other instances in the VPC, and an entry that enables instances in the subnet to communicate directly with the internet.

  • The main route table associated with the VPN-only subnet. The route table contains an entry that enables instances in the subnet to communicate with other instances in the VPC, and an entry that enables instances in the subnet to communicate directly with your network.

For more information, see Subnets. For more information about internet gateways, see Connect to the internet using an internet gateway. For more information about NAT gateways, see NAT gateways. For more information about your AWS Site-to-Site VPN connection, see the AWS Site-to-Site VPN User Guide.

IPv6 configuration

You can optionally enable IPv6 for this scenario. In addition to the components listed above, the configuration includes the following:

  • A size /56 IPv6 CIDR block associated with the VPC (example: 2001:db8:1234:1a00::/56). AWS automatically assigns the CIDR; you cannot choose the range yourself.

  • A size /64 IPv6 CIDR block associated with the public subnet (example: 2001:db8:1234:1a00::/64). You can choose the range for your subnet from the range allocated to the VPC. You cannot choose the size of the IPv6 CIDR.

  • A size /64 IPv6 CIDR block associated with the VPN-only subnet (example: 2001:db8:1234:1a01::/64). You can choose the range for your subnet from the range allocated to the VPC. You cannot choose the size of the IPv6 CIDR.

  • IPv6 addresses assigned to the instances from the subnet range (example: 2001:db8:1234:1a00::1a).

  • Route table entries in the custom route table that enable instances in the public subnet to use IPv6 to communicate with each other, and directly over the internet.

  • A route table entry in the main route table that enable instances in the VPN-only subnet to use IPv6 to communicate with each other.

The web servers in the public subnet have the following addresses.

ServerIPv4 addressElastic IP addressIPv6 address

1

10.0.0.5

198.51.100.12001:db8:1234:1a00::1a

2

10.0.0.6

198.51.100.22001:db8:1234:1a00::2b310.0.0.7198.51.100.32001:db8:1234:1a00::3c

The database servers in the private subnet have the following addresses.

ServerIPv4 addressIPv6 address

1

10.0.1.5

2001:db8:1234:1a01::1a

2

10.0.1.6

2001:db8:1234:1a01::2b310.0.1.72001:db8:1234:1a01::3c

Routing

Your VPC has an implied router (shown in the configuration diagram for this scenario). In this scenario, Amazon VPC updates the main route table used with the VPN-only subnet, and creates a custom route table and associates it with the public subnet.

The instances in the VPN-only subnet can't reach the internet directly; any internet-bound traffic must first traverse the virtual private gateway to your network, where the traffic is then subject to your firewall and corporate security policies. If the instances send any AWS-bound traffic (for example, requests to the Amazon S3 or Amazon EC2 APIs), the requests must go over the virtual private gateway to your network and then egress to the internet before reaching AWS.

Any traffic from your network going to an Elastic IP address for an instance in the public subnet goes over the internet, and not over the virtual private gateway. You could instead set up a route and security group rules that enable the traffic to come from your network over the virtual private gateway to the public subnet.

The Site-to-Site VPN connection is configured either as a statically-routed Site-to-Site VPN connection or as a dynamically-routed Site-to-Site VPN connection (using BGP). If you select static routing, you'll be prompted to manually enter the IP prefix for your network when you create the Site-to-Site VPN connection. If you select dynamic routing, the IP prefix is advertised automatically to the virtual private gateway for your VPC using BGP.

The following tables describe the route tables for this scenario.

Main route table

The first entry is the default entry for local routing in the VPC; this entry enables the instances in the VPC to communicate with each other over IPv4. The second entry routes all other IPv4 subnet traffic from the private subnet to your network over the virtual private gateway (for example, vgw-1a2b3c4d).

DestinationTarget10.0.0.0/16local0.0.0.0/0vgw-id

Custom route table

The first entry is the default entry for local routing in the VPC; this entry enables the instances in the VPC to communicate with each other. The second entry routes all other IPv4 subnet traffic from the public subnet to the internet over the internet gateway (for example, igw-1a2b3c4d).

DestinationTarget10.0.0.0/16local0.0.0.0/0igw-id

Alternate routing

Alternatively, if you want instances in the private subnet to access the internet, you can create a network address translation (NAT) gateway or instance in the public subnet, and set up the routing so that the internet-bound traffic for the subnet goes to the NAT device. This enables the instances in the VPN-only subnet to send requests over the internet gateway (for example, for software updates).

For more information about setting up a NAT device manually, see Connect to the internet or other networks using NAT devices.

To enable the private subnet's internet-bound traffic to go to the NAT device, you must update the main route table as follows.

The first entry is the default entry for local routing in the VPC. The second entry routes the subnet traffic bound for your own local (customer) network to the virtual private gateway. In this example, assume your local network's IP address range is 172.16.0.0/12. The third entry sends all other subnet traffic to a NAT gateway.

DestinationTarget10.0.0.0/16local172.16.0.0/12vgw-id0.0.0.0/010.0.0.0/160

Routing for IPv6

If you associate an IPv6 CIDR block with your VPC and subnets, your route tables must include separate routes for IPv6 traffic. The following tables show the route tables for this scenario if you choose to enable IPv6 communication in your VPC.

Main route table

The second entry is the default route that's automatically added for local routing in the VPC over IPv6.

DestinationTarget10.0.0.0/16local10.0.0.0/162local0.0.0.0/0vgw-id

Custom route table

The second entry is the default route that's automatically added for local routing in the VPC over IPv6. The fourth entry routes all other IPv6 subnet traffic to the internet gateway.

DestinationTarget10.0.0.0/16local10.0.0.0/162local0.0.0.0/0igw-id::/0igw-id

Security

AWS provides features that you can use to increase security for the resources in your VPC. Security groups allow inbound and outbound traffic for associated resources, such as EC2 instances. Network ACLs allow or deny inbound and outbound traffic at the subnet level. In most cases, security groups can meet your needs. However, you can use network ACLs if you want an additional layer of security. For more information, see Compare security groups and network ACLs.

For this scenario, you'll use security groups but not network ACLs. If you'd like to use a network ACL, see Recommended network ACL rules.

Your VPC comes with a default security group. An instance that's launched into the VPC is automatically associated with the default security group if you don't specify a different security group during launch. For this scenario, we recommend that you create the following security groups instead of using the default security group:

  • WebServerSG: Specify this security group when you launch web servers in the public subnet.

  • DBServerSG: Specify this security group when you launch database servers in the VPN-only subnet.

The instances assigned to a security group can be in different subnets. However, in this scenario, each security group corresponds to the type of role an instance plays, and each role requires the instance to be in a particular subnet. Therefore, in this scenario, all instances assigned to a security group are in the same subnet.

The following table describes the recommended rules for the WebServerSG security group, which allow the web servers to receive internet traffic, as well as SSH and RDP traffic from your network. The web servers can also initiate read and write requests to the database servers in the VPN-only subnet, and send traffic to the internet; for example, to get software updates. Because the web server doesn't initiate any other outbound communication, the default outbound rule is removed.

The group includes both SSH and RDP access, and both Microsoft SQL Server and MySQL access. For your situation, you might only need rules for Linux (SSH and MySQL) or Windows (RDP and Microsoft SQL Server).

InboundSourceProtocolPort RangeComments

0.0.0.0/0

TCP

80

Allow inbound HTTP access to the web servers from any IPv4 address.

0.0.0.0/0

TCP

443

Allow inbound HTTPS access to the web servers from any IPv4 address.

Your network's public IP address range

TCP

22

Allow inbound SSH access to Linux instances from your network (over the internet gateway).

Your network's public IP address range

TCP

3389

Allow inbound RDP access to Windows instances from your network (over the internet gateway).

Outbound

The ID of your DBServerSG security group

TCP

1433

Allow outbound Microsoft SQL Server access to the database servers assigned to DBServerSG.

The ID of your DBServerSG security group

TCP

3306

Allow outbound MySQL access to the database servers assigned to DBServerSG.

0.0.0.0/0

TCP

80

Allow outbound HTTP access to the internet.

0.0.0.0/0

TCP

443

Allow outbound HTTPS access to the internet.

The following table describes the recommended rules for the DBServerSG security group, which allow Microsoft SQL Server and MySQL read and write requests from the web servers and SSH and RDP traffic from your network. The database servers can also initiate traffic bound for the internet (your route table sends that traffic over the virtual private gateway).

InboundSourceProtocolPort rangeComments

The ID of your WebServerSG security group

TCP

1433

Allow inbound Microsoft SQL Server access from the web servers associated with the WebServerSG security group.

The ID of your WebServerSG security group

TCP

3306

Allow inbound MySQL Server access from the web servers associated with the WebServerSG security group.

Your network's IPv4 address range

TCP

22

Allow inbound SSH traffic to Linux instances from your network (over the virtual private gateway).

Your network's IPv4 address range

TCP

3389

Allow inbound RDP traffic to Windows instances from your network (over the virtual private gateway).

Outbound

DestinationProtocolPort rangeComments

0.0.0.0/0

TCP

80

Allow outbound IPv4 HTTP access to the internet (for example, for software updates) over the virtual private gateway.

0.0.0.0/0

TCP

443

Allow outbound IPv4 HTTPS access to the internet (for example, for software updates) over the virtual private gateway.

(Optional) The default security group for a VPC has rules that automatically allow assigned instances to communicate with each other. To allow that type of communication for a custom security group, you must add the following rules:

InboundSourceProtocolPort rangeComments

The ID of the security group

All

All

Allow inbound traffic from other instances assigned to this security group.

OutboundDestinationProtocolPort rangeCommentsThe ID of the security groupAllAllAllow outbound traffic to other instances assigned to this security group.

Security group rules for IPv6

If you associate an IPv6 CIDR block with your VPC and subnets, you must add separate rules to your WebServerSG and DBServerSG security groups to control inbound and outbound IPv6 traffic for your instances. In this scenario, the web servers will be able to receive all internet traffic over IPv6, and SSH or RDP traffic from your local network over IPv6. They can also initiate outbound IPv6 traffic to the internet. The database servers cannot initiate outbound IPv6 traffic to the internet, so they do not require any additional security group rules.

The following are the IPv6-specific rules for the WebServerSG security group (which are in addition to the rules listed above).

InboundSourceProtocolPort rangeComments

::/0

TCP

80

Allow inbound HTTP access to the web servers from any IPv6 address.

::/0

TCP

443

Allow inbound HTTPS access to the web servers from any IPv6 address.

IPv6 address range of your network

TCP

22

(Linux instances) Allow inbound SSH access over IPv6 from your network.

IPv6 address range of your network

TCP

3389

(Windows instances) Allow inbound RDP access over IPv6 from your network

OutboundDestinationProtocolPort rangeComments::/0TCPHTTPAllow outbound HTTP access to any IPv6 address.::/0TCPHTTPSAllow outbound HTTPS access to any IPv6 address.

Implement this scenario

To implement this scenario, get information about your customer gateway and create the VPC.

These procedures include optional steps for enabling and configuring IPv6 communication for your VPC. You do not have to perform these steps if you do not want to use IPv6 in your VPC.

To prepare your customer gateway

  1. Determine the device you'll use as your customer gateway device. For more information, see Your customer gateway device in the AWS Site-to-Site VPN User Guide.

  2. Obtain the internet-routable IP address for the customer gateway device's external interface. The address must be static and may be behind a device performing network address translation (NAT).

  3. If you want to create a statically-routed Site-to-Site VPN connection, get the list of internal IP ranges (in CIDR notation) that should be advertised across the Site-to-Site VPN connection to the virtual private gateway. For more information, see Route tables and VPN route priority in the AWS Site-to-Site VPN User Guide.

For information about how to use Amazon VPC with IPv6, see VPC that supports IPv6 addressing.

For this scenario, you can create a network ACL for the public subnet and a separate network ACL for the VPN-only subnet. The following table shows the rules that we recommend for each network ACL. They block all traffic unless it is explicitly required.

InboundRule #Source IPProtocolPortAllow/DenyComments

100

0.0.0.0/0

TCP

80

ALLOW

Allows inbound HTTP traffic to the web servers from any IPv4 address.

110

0.0.0.0/0

TCP

443

ALLOW

Allows inbound HTTPS traffic to the web servers from any IPv4 address.

120

Public IPv4 address range of your home network

TCP

22

ALLOW

Allows inbound SSH traffic to the web servers from your home network (over the internet gateway).

130

Public IPv4 address range of your home network

TCP

3389

ALLOW

Allows inbound RDP traffic to the web servers from your home network (over the internet gateway).

140

0.0.0.0/0

TCP

32768-65535

ALLOW

Allows inbound return traffic from hosts on the internet that are responding to requests originating in the subnet.

This range is an example only. For information about choosing the correct ephemeral ports for your configuration, see Ephemeral ports.

Which kind of security is used for securing the network in AWS?

AWS Identity and Access Management (IAM) enables you to securely control access to AWS services and resources for your AWS users, groups, and roles. Using IAM, you can create and manage fine-grained access controls with permissions, specify who can access which services and resources, and under which conditions.

Which network security protocol is used with AWS client to site VPNS?

Secure connectivity AWS Client VPN uses the secure TLS VPN tunnel protocol to encrypt the traffic.

Does AWS Direct Connect use TLS?

As a managed service, AWS Direct Connect is protected by the AWS global network security procedures. You use AWS published API calls to access AWS Direct Connect through the network. Clients must support Transport Layer Security (TLS) 1.0 or later.

Does AWS VPN use IPsec?

Secure. With AWS Site-to-Site VPN, you can connect to an Amazon VPC or AWS Transit Gateway the same way you connect to your on-premises servers. AWS Site-to-Site VPN establishes secure and private sessions using IP Security (IPSec).