Showing posts with label ELB. Show all posts
Showing posts with label ELB. Show all posts

Sep 2, 2018

How can you terminate custom/external HTTPS SSL certificate in AWS ELB and EC2

How can you terminate custom/external HTTPS SSL certificate in AWS ELB & EC2?
    1) at ELB level
        use AWS certificate manager, create a certificate & upload your existing certificate
        In ELB Listener rules, configure HTTPS(443 port) & attach the above certificate
        Limitation: You can add only one certificate per an ELB
    2) at EC2 level
        Suppose if you have multiple sites under EC2 (multi-tenant) & want to terminate HTTPS certificates for all the sites
        Having an ELB for each site will be costly solution, then you need to use TCP pass through solution
            https://test1.com
            https://test2.com
            https://test2.com
        In ELB Listener rules, configure TCP (443 port) pass through
        You could not obtain the clients IP address if the ELB was configured for TCP load balancing, so enable proxy protocol
        Enable proxy protocol in ELB through CLI (not available in AWS console), which allows X-Forwarded-For headers  
        Then the termination happens at you EC2 server level (Nginx/Apache)
       
        Nginx:
            server {
              listen *:443 ssl proxy_protocol;
              server_name *.site.com;
              set_real_ip_from 0.0.0.0/0;
              real_ip_header proxy_protocol;

              ssl on;
              ssl_certificate /opt/site/conf/ssl_keys/nginx_site.crt;
              ssl_certificate_key /opt/site/conf/ssl_keys/site.pem;

              location / {
                proxy_pass            http://127.0.0.1:80;
                proxy_read_timeout    90;
                proxy_connect_timeout 90;
                proxy_redirect        off;

                proxy_set_header      X-Real-IP $proxy_protocol_addr;
                proxy_set_header      X-Forwarded-For $proxy_protocol_addr;
                proxy_set_header      X-Forwarded-Proto https;
                proxy_set_header      X-Forwarded-Port 443;
                proxy_set_header      Host $host;
                proxy_set_header      X-Custom-Header nginx;
              }
            }

Apr 9, 2018

AWS ELB

Classic ELB
    Supported Protocols
        HTTP, HTTPS (Secure HTTP), SSL (Secure TCP) and TCP protocols
    TCP Ports
        [EC2-VPC] 1-65535
        [EC2-Classic] 25, 80, 443, 465, 587, 1024-65535
    IPv6 support
        Each Classic Load Balancer has an associated IPv4, IPv6, and dualstack (both IPv4 and IPv6) DNS name.
        IPv6 is not supported in VPC. You can use an Application Load Balancer for native IPv6 support in VPC.
    Cross-Zone Load Balancing
        This option distributes traffic evenly across all your back-end instances in all Availability Zones.
        This reduces to maintain equivalent no of instances in each enabled AZ (But it is recommended to maintain to same no of instances in each AZ for higher fault tolerance)
        This option is enabled by default in AWS console
        This option is disabled by default in AWS API/CLI
    Can I privately access Elastic Load Balancing APIs from my Amazon Virtual Private Cloud (VPC) without using public IPs?
        Yes, you can privately access Elastic Load Balancing APIs from your Amazon Virtual Private Cloud (VPC) by creating VPC Endpoints
            


Application ELB
    Supported Protocols
        HTTP, HTTPS (Secure HTTP)
    TCP ports
        1-65535
    Can I convert my Classic Load Balancer to an Application Load Balancer (and vice versa)? - No
    Can I migrate to Application Load Balancer from Classic Load Balancer? - Yes
    Can I use an Application Load Balancer as a Layer-4 load balancer?
        No. If you need Layer-4 features, you should use Network Load Balancer.
    Is IPv6 supported with an Application Load Balancer? - Yes
    Can I associate multiple certificates for the same domain to a secure listener?
        Yes, you can associate multiple certificates for the same domain to a secure listener. For example, you can associate
        (a) ECDSA and RSA certificates
        (b) Certificates with different key sizes (e.g. 2K and 4K) for SSL/TLS certificates
        (c) Single-Domain, Multi-Domain (SAN) and Wildcard certificates




Network ELB
    Can I create a TCP (Layer 4) listener for my Network Load Balancer?
        Yes. Network Load Balancers support only TCP (Layer 4) listeners.
    Network Load Balancer Vs TCP listener on a Classic Load Balancer?
        Network Load Balancer preserves the source IP of the client which in the Classic Load Balancer is not preserved.
        Customers can use proxy protocol with Classic Load Balancer to get the source IP.
        Network Load Balancer automatically provides a static IP per Availability Zone to the load balancer and also enables assigning an Elastic IP to the load balancer per Availability Zone. This is not supported with Classic Load Balancer.
        Classic Load Balancer provides SSL termination that is not available with Network Load Balancer.