Unable to access https endpoint of apache installed in EC2 - amazon-web-services

I am running apache server within my ec2 instance and I am trying to access a static index.html. When I type http:// , I see the page displayed. However when I type https:// , the page isn't opening. Below is the security group setting. What am I missing?
HTTP TCP 80 0.0.0.0/0
HTTP TCP 22 0.0.0.0/0
Custom TCP Rule TCP 443 0.0.0.0/0

Related

AWS - Connection timing out on an EC2 Load balancer configured to port 443 with an SSL certificate

I have tried everything to get this to connect with HTTPS. I have added the SSL certificate to my IAM console, added the security group needed to open port 443 and attached it to my load balancer, and have added the HTTPS listener to my load balancer.
Still, I am getting a timeout when going to the HTTPS URL. The HTTP port is open and connects without issue.
I honestly don't know what information might be needed here, as this is my first go at setting up an HTTPS connection on an EC2 instance. Below are some screenshots of how things are set up in the EC2 console:
Load balancer listeners:
Load balancer port configuration:
And finally the Security Groups:
I realize these may not be the right details, and I cringe at the screenshots, but I am a one-man-band tasked to set this up, and I have no one to turn to for help! Thank you in advance for reading this and any insight provided.
I was able to make this work.
In the load balancer listener, I had an HTTP and HTTPS listener configured as so:
Load Balancer Protocol: HTTP | Load Balancer Port: 80 | Instance Port: 80
Load Balancer Protocol: HTTPS | Load Balancer Port: 443 | Instance Port: 80 | SSL Cert
The HTTPS listener was timing out no matter what I did. I even edited the security group to allow connections to port 443.
What I ended up doing was changing the HTTPS listener to this:
Load Balancer Protocol: SSL | Instance Protocol: TCP | Load Balancer Port: 443 | Instance Port: 80
And now I can connect to the HTTPS url. I have no idea why this works, but it does and it's good enough for me.

Configure https on multiple port in AWS beanstalk

I have two docker containers in beanstalk instances, One listen on port 80, another one listen port 8080. The security group allows port 80,8080. I can access url on port 80 and 8080 using http. I want to use https. I have created a certificate in ACM. Updated the load balancer in beanstalk env as below. but now i can not access website using https.ImagePorts
You need to https listener in your Load balancer, from the image the protocol is https but the port is 80
Create an https listener in LB
Map 443 of LB with 80 of the target
allow 443 in the SG of LB
instance port should be 80. As the SSL traffic decrypt before sending to the target.
If you are interested to add SSL with 8080 then you need to specify certificate with 8080 as well.

Accessing EC2 Instance via Internet Security Rules

I have configured an EC2 instance and I am now trying to install an open source app (Wiki.js). One of the steps (visible here under configuration) requires me to navigate to http://localhost:3000/ but replace localhost with the IP address of my server. I have tried this multiple times and tried different variations of security groups for the EC2 Instance but nothing seems to work. Currently the inbound rules are set to the following:
1)
Type: HTTP
Protocol: TCP
Port Range: 80
Source: 0.0.0.0/0
2)
Type: HTTPS
Protocol: TCP
Port Range: 443
Source: 0.0.0.0/0
3)
Type: SSH
Protocol: TCP
Port Range: 22
Source: 0.0.0.0/0
I'm not sure what the problem could be. Are these security settings wrong? Am I using the wrong IP address? I am coping the address directly from the console under Iv4 Public IP.
EDIT:
Could it have something to do with the route table or subnet? If so it doesn't appear to be possible to edit those via the console. Would I need create a new instance?
Why don't you open port 3000 for the EC2 instance ?
I think the application requires you to access port 3000. But you don't configure that security group.

AWS Load Balancer - All HTTPS requests are resulting in 503 error, but SSL has a cert?

I've recently added an SSL cert to my Load Balancer using an HTTPS listener.
I've updated the Security Group for the Load Balancer to allow HTTPS traffic through on port 443, from sources 0.0.0.0/0 and ::/0, and I've also set the Security Group for the instances themselves to allow HTTPS traffic from the Load Balancer's Security Group.
However any requests to our server using HTTPS fail, but using HTTP gets through fine.
In EC2->LoadBalancers I see a Listeners tab, and have the following in it:
LB Protocol - LB Port - Ins Protocol - Ins Port - Cipher - SSL Certificate
HTTP - 80 - HTTP - 80 - N/A - N/A
HTTPS - 443 - HTTPS - 443 - Change - myCertName (IAM) Change
Clicking Change on the Cipher shows I have the latest Security Policy selected (ELBSecurityPolicy-2016-08), and the SSL certificate is the one I generated yesterday.
If I go into EC2 -> Security Groups I see the following:
For the security group that the 2 instances are using:
Type - Protocol - Range - Source
HTTP - TCP - 80 - sg-123456
HTTPS - TCP - 443 - sg-123456
(where sg-123456 is the name of the security group the load balancer is using).
For the security group that the LoadBalancer is using:
Type - Protocol - Range - Source
HTTPS - TCP - 443 - 0.0.0.0/0
HTTPS - TCP - 443 - ::/0
HTTP - TCP - 80 - 0.0.0.0/0
HTTP - TCP - 80 - ::/0
I also tried Elastic Beanstalk -> my app - > my env - > Configuration - > Network Tier -> Load Balancing:
It had Secure listener port set to OFF. I set this to 443, the Protocol to HTTPS and then set the SSL certificate ID dropdown to the same certificate I uploaded to the Load Balancer listener.
I hit save, it started to update the environment, and then gave this error:
Updating load balancer named: failed Reason: A listener already exists for with LoadBalancerPort 443, but with a different InstancePort, Protocol, or SSLCertificateId
I feel like there is probably a single step I've missed somewhere along the way, can anyone see what that step could be?
You are forwarding SSL traffic to port 443 on your EC2 instances. This isn't going to work unless you also have an SSL certificate installed on your EC2 instances. Changing the SSL listener to use Instance Protocol HTTP and Instance Port 80 will most likely clear up your issue.

Aws Elastic Load Balancer

I am running NodeJS app on EC2 instance on port 3000 without having any apache or nginx. I have setup ELB at front with SSL enabled( ACM on ELB ). Now I want to open my web-app url with https always.I have redirected port 443 request to port 3000 which is open on https. Same I want to do with port 80 request to go with 443 and then finally end up to port 3000, Because if someone request with port 80 for the web-app url that should also redirect to https and then end up on port 3000.
So Can you tell me How can I implement on ELB this thing for port 80 request which also open with https. My port 3000 is on http on EC2 instance.
port 443 https ----> port (3000) http ( its working )
port 80 (http) ---->want to open with https(443 ) ----->port(3000 ) http (this I want to implement)
I'm afraid ELB doesn't have built in support for this feature. It's something your web app would need to deal with.
You could set the ELB to forward port 80 to port 3000 too, and then in your app you'd need to inspect the X-Forwarded-Proto header; if this is not https then you would issue a redirect to port 443.
Amazon's X-Forwarded Docs
for solution to this, we need to run something on port 80 that could be sample nodeJS app or any default web-page(html or php) and then redirect port 80 request to port 443 and port 443 will redirect to port 3000(setup inside aws ELB) which is running actual NodeJS app.