AWS Application Load Balancer with SSL Certificate and WAF - amazon-web-services

i created an architecture for my WebApplication. In Front of my Application which runs on ECS i use an Application Load Balancer configured with an SSL Certificate from Certificate Manager and a Route53 Domain. To secure my ALB i use a WAF associated with my ALB. In my ALB i configured a listener for https and a listener for http, which redirects the traffic to https.
Everything works fine. But i saw that the DNS Name of my Application Load Balancer in the Browser is still available over http and i reach my app over this way through http. How can i deny this connection over the ALB DNS Name or hown can i make it secure? My goal is that all inbound https connections end at the ALB. Then the ALB directs the traffic over http to the Application.
Best regards,
L.J.

You can redirect HTTP to HTTPS as explained in AWS docs:
How can I redirect HTTP requests to HTTPS using an Application Load Balancer?

Related

AWS ELB causing net::ERR_CERT_COMMON_NAME_INVALID error

Currently getting the net::ERR_CERT_COMMON_NAME_INVALID when trying to access my application through the ALB.
This is my current setup:
SSL Certificate created that covers example.com & *.example.com using AWS Certificate Manager.
2 server ec2 instances behind a load balancer and 2 client instances behind another load balancer.
An alias record in my Route 53 hosted zone pointing to the client ALB.
Both ALBs have the SSL certificate for example.com attached to them.
Both ALBs have a single HTTPS: 443 listener forwarding https traffic to ec2 instances on port 80.
The server ALB security group allows inbound traffic from the client ALB Security Group and outbound to the server instances security group.
The applications in the client ec2 instances are React Apps pointing to the server ALB at https://xxxxxxxxxx.elb.amazonaws.com/api
Accessing the application via https://example.com causes net::ERR_CERT_COMMON_NAME_INVALID in the console with the browser saying:
Error: The certificate for this server is invalid. You might be connecting to a server that is pretending to be “xxxxxxxxxx.elb.amazonaws.com” which could put your confidential information at risk.
I'd be happy to provide more details if it helps.
If you have your own domain example.com with correct SSL certificate then you can't use https://xxxxxxxxxx.elb.amazonaws.com/api which is AWS domain. The reason is that SSL cert is for example.com, not for https://xxxxxxxxxx.elb.amazonaws.com/api.
You have to modify your application code to only use example.com.

Does the AWS Application Load Balancer handle reverse proxy?

I am trying to use the AWS application load balancer in my application with WAF support in it. At the same time, I also need support for reverse proxy. Does the AWS application load balancer handle reverse proxy?
Not sure if we talk about the same thing, but in my understanding, AWS ALB's are reverse proxy servers.
You add your actual application server(s) in a targetgroup to an ALB listener, and then, external clients connecting to the ALB over http/https will see your application as if it was served by the ALB.
You can add HTTP request filtering to the ALB listener, so you can configure which requests go to which targetgroup, both by domain name and http paths.
ALB's also do SSL offloading, i.e. it handles https handshakes with a server certificate registered in the ALB, so your own application server doesn't need to do that anymore.
No, it can't.
To do reverse proxy in AWS, you can set a NAT Gateway in your VPC. This way, all connections from your servers to a specific IP (or the public internet) will be a single IP.

AWS Elb backend authentication

I was reading about backend authentication option in AWS ELB.
What it mentions is there is a instance public key (.pem encoded) to be configured in ELB.
What I could not understand is what is this key or certificate?
Since it is optional will the traffic will still be encrypted between ELB and EC2 instances if port 443 is used.
There is no details mentioned on how to actually do this.
Basically I want end to end encryption from user to elb and elb to ec2.
Basically what this is saying is that if you what encryption in transit for the entire journey you will need to install an SSL certificate on your EC2 instance. The journey will look like the below.
client ---(HTTPS)--> load balancer ---(HTTPS)--> EC2 host
You will need to either purchase an SSL, or use a free option such as certbot on your server.
Then once you have this you will need to configure for the web server software you are running. Below are some instructions for common web servers:
Apache
Nginx
IIS
Tomcat
Ensure that your target group is configured for HTTPS port 443 traffic, to have the load balancer forward requests to HTTPS on your backend.
If the load balancer to EC2 host is not encrypted (plain HTTP) the clients traffic to load balancer will still be encrypted, but after this will be forward in HTTP.

Does each server (EC2 Node) behind a load balancer need their own SSL certificate?

I have 2 EC2 nodes behind a load balancer.
I need to setup SSL certificate for use with Amazon Web Services.
Does each server behind a load balancer need their own SSL certificate?
Or only the load balancer need the SSL certificate?
You can associate the SSL certificate with the load balancer, and then use either normal HTTP between the Load Balancer and the server, or another form of authentication that is less resource-intensive than SSL.
See:
HTTPS Listeners for Your Classic Load Balancer
HTTPS Listeners for Your Application Load Balancer

elastic load balancer port redirection?

i configured an ELB for an ec2 instance such the load balancer receives data from http:80 send it to https:443 to instances. But when i entered ELB DNS url , it is not redirecting to https.
output of ELB is:
it is showing the output of port 80. can anyone please help to configure elb such that it redirects incoming port 80 traffic to port 443 to ec2 instacne.
Load balancer used to send and receive traffic from different ports from the EC2 instances attached to that Load Balancer. You cannot setup any redirect using a Load Balancer. For redirects you have to set that up using the Web Server of your EC2 instance attached to that load balancer.
Also as per the https goes either you add a SSL certificate to the EC2 instance or the ELB. But that SSL certificate will be for the domain you are going to use for your application, and you do not own the domain "amazonaws.com" so your load balancer URL will never work for https. You have get a Domain and a SSL certificate for that domain upload that SSL certificate to ELB or the EC2 instance and then point the domain to the ELB by adding a C-Name. Then your domain will work for https ://www.domain.com if you have set everything correctly in the web server.
It sounds like you want to redirect HTTP requests to HTTPS. This is more than just a port "redirect", it is also a protocol change. To properly redirect HTTP traffic to HTTPS you will need to configure your web server to do that.