Vert.x, Elastic Beanstalk, and HTTPS - amazon-web-services

I have a Vert.x server running on a single-instance Elastic Beanstalk server, and I'm trying to configure it to operate over HTTPS. I've set up the NS records and A record in AWS Route 53 to map the subdomain to my instance (pinging the subdomain succeeds), requested (and verified) the certificate from ACM, and opened up port 443 in my EC2 security group. But I can't quite figure out how to "attach" the certificate to my domain (if that's somehow necessary) or to get port 443 properly mapped to my Vert.x server.
Any tips will be appreciated.

to get port 443 properly mapped to my Vert.x server.
If you use ACM for the SSL certificate, you have to setup application load balancer. The process is detailed in:
How can I configure HTTPS for my Elastic Beanstalk environment?
To enable load balancer for your EB environment, you have to change EB environment type to Load-balanced if you already don't have that.
With the load balancer, you don't have to modify your application at all, as HTTPS will be fully handled by the load balancer.

Related

AWS Lightsail Load Balancer: Change default ports from 80/443

So I've setup an AWS Lighsail load balancer and attached it to a single instance.
My instance is running a REST API on port 8080. I'd like to be able to route HTTP (and down track HTTPS) requests hitting the front end of the load balancer to port 8080 on my instance. By default the load balancer routes to port 80 on the attached instance.
I'd also like to change the default ports on the load balancer. The load balancer listens on ports 80 & 443. It says these are 'defaults' in the AWS Lightsail console.
I'm struggling to find any settings related to changing default ports or port forwarding.
Any help would be much appreciated...
Seem it's not possible to change default port of AWS Lightsail Load Balancer. Lightsail instance install Bitnami package which includes Apache httpd service. This httpd service hosts the port 80 by default, and expected to receive traffic from AWS Load Balancer and forwards to your application. Therefore, your application run in Lightsail instance should be configured to be proxied by this httpd service.
If you want AWS Load Balancer to direct traffic to your application, not via httpd service, just stop this httpd service and then start your application using port 80.

AWS EC2 Instance - How to add a Load Balancer to an Instance Application that already has an Elastic IP and SSL?

I have an Ubuntu 18.04 LTS EC2 Instance with a deployed Django application. The instance also has an elastic IP. The Django application already has a domain name mapped to it in nginx, and it also already has an SSL certificate mapped using certbot.
My questions are:
Do I need to add an HTTPS listener to the load balancer? If yes, do I use the SSL generated by certbot? How?
Do I need to change the IPV4 that is in the nginx config file and DNS record with the new IPV4 of the load balancer created?
Do I need to add an HTTPS listener to the load balancer? If yes, do I use the SSL generated by certbot? How?
Yes, you would need to create a HTTPS listener and you need to use a certificate, you can import the same certificate you're using on nginx or get a new certificate from ACM (free), both will work as long as the subject/SAN are correct.
Do I need to change the IPV4 that is in the nginx config file and DNS record with the new IPV4 of the load balancer created?
ELB provided DNS name , the IP changes so you can't use IP address but after using ELB, you don't need elastic IP on EC2 instance , the communication between ELB and EC2 is on private IP so you can allow 0.0.0.0 in nginx and restrict ELB to make connections to ec2 instance, you will need to point your website to ELB DNS name eventually.

ELB to ALB Transition

I have a nodejs aws beanstalk environment which is currently using a elb load balancer configured with an ssl certificate for https request. I am trying to redirect http to https but this can only be done with an alb balancer. When creating this alb balancer I cannot attach my beanstalk instance to this alb but only to the previous elb attached to it? why?
To attach your Elastic BeanStalk instance to Application Load Balancer you need to update configurations from Elastic BeanStalk environment.
Below are the steps to update the Elastic BeanStalk environment:
Go to your Elastic Beanstalk environment.
On the left-hand side select "Configuration" option.
Select "Load Balancer" and choose Application Load Balancer, make sure in "Capacity" your "Environment type: Load Balancing, Auto-Scaling".
Under the Application Load Balancer, choose option Add Listener, after that provide Port, Protocol, and SSL certificate and make it enabled. So you will redirect your requests http to https.
Note: To provide an SSL certificate, you need to upload certificate contents in the ACM(AWS Certificate Manager).
Apply the configuration and you will observe that your instance gets added to your new Application Load Balancer deployed through Elastic BeanStalk environment.

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.

Issues with EC2 Load balancer, SNI, multiple SSL domains on the same server

i am having issues setting up an EC2 load balancer, on a instance, that has multiple domains protected by SSL.
Is it possible to make the load balancer pass the HTTPS request as is, and get it decrypted at the server level? If so, how do i set that up?
I have a standard LAMP setup on a EC2.
On your Elastic Load Balancer, configure a TCP listener that listens on port 443 and forwards to port 443 on the instances. This will allow your EC2 instances to perform the SSL termination.
Note that you won't be able to use Sticky Sessions in this configuration.