I have develop an node.js app and successfully upload and deploy it using AWS tools and Elastic Beanstalk. My app is reachable through the url provided by EB.
I create a SSL Certification through AWS Certificate Manager and assign it from configuration menu. Load Balancer Config
When i checked Load balancer and security group configuration everything looks fine but if i'm trying to get https://myappurl.us-west-2.elasticbeanstalk.com i get privacy error response.
I think that this is more likely a Amazon support question but maybe someone know if i miss something.
Thanks
The SSL certificate will be for a specific domain. It is certainly not for the myappurl.us-west-2.elasticbeanstalk.com domain because you don't own the domain elasticbeanstalk.com so there's no way you could have created a valid SSL certificate for that domain. The SSL certificate is only going to work with the custom domain you created the certificate for, and only when you have that custom domain actually pointing to your Elastic Beanstalk environment.
SSL certificate works as per the domain name they were generated. As per your comment you got that certificate for myapp.mydomain.io so it will not work for myappurl.us-west-2.elasticbeanstalk.com you have to map myapp.mydomain.io to point to the EB and then your myapp.mydomain.io will serve the SSL certificate. https://myapp.mydomain.io.
Related
I have deployed a Python Flask based app in AWS. It is running fine on http://<ip>. I need to convert this to https. I have sent request for admin to enable port 443 for https.
Will that automatically make my app to https or do I need to install or setup something else to make it happen?
You have multiple choices for this;
Use ACM (Easiest?!):
if you're using AWS loadbalancers, you can create a certificate using ACM service and assign it to your loadbalancer and modify your Target Groups in EC2 panel.
If you are using cloudfront, you can also configure your SSL/TLS there. (Not changing the loadbalancer and target groups). It will work as an upper layer.
Use other certificate providers excluding AWS ACM:
You can setup something like Lets Encrypt or use Cloudflare services.
Note: it really depends on how your cloud stack currently is, you maybe be only deploying on EC2 Server and having Nginx configured and having everything else done outside of AWS with other services or you can have Lets Encrypt certificate on your ALB.
This post just gives you some keywords, you can search and see exact instruction/tutorial for every solutions.
I hava a Nodejs/Express application running on AWS. My public URL (www.example.com) is registered in a host provider (SiteGround).
My host provider DNS entry for the application points to AWS (application.example.com points to my AWS public IP).
My host provider has also our company web site running WordPress.
So, if you point to our public URL you get our website. Pointing to the application you get our SaaS login page.
All of that runs fine with HTTP. I have now a task to migrate everything to HTTPS. I've checked how to add HTTPS to nodejs, all fine.
My question is related to certificates. Questions:
a) Should I get the SSL certificate on my host company or on AWS? Both offers the certificates.
b) Do I need a certificate on AWS (to be added to nodejs) and at my domain (to allow HTTPS domain access) or just in nodejs ?
It does not matter from where you get your certificate as long as your provider gives you an authorized certificate. However, if you use Amazon's certificate manager, it can be be easier to integrate with their services.
If you are serving your application through AWS load balancer then you don't need to add it to the Node.js application, instead you get a certificate through the certificate manager and add it to the listening interface in the load balancer, it gets served automatically this way.
Create a Classic Load Balancer with an HTTPS Listener
HTTPS Listeners for Your Application Load Balancer
If you are serving your application directly, then you will need to add it to the Node.js application (e.g. using https module).
I'll try to answer each question below:
a) Should I get the SSL certificate on my host company or on AWS? Both
offers the certificates.
If the Amazon issued certificate is strong enough for your needs, like basic https encryption, I would opt to use them for the sake of simplicity. You just need to fill the form, validate and Amazon is in charge of making it secure and renew it automatically when it expires.
b) Do I need a certificate on AWS (to be added to nodejs) and at my
domain (to allow HTTPS domain access) or just in nodejs ?
AWS issued certificates can only be used with AWS managed services such as Application Load Balancer and CloudFront - CDN. There are many docs explaining about how to setup an ELB with AWS Certificate and EC2 Backend, check Create a Classic Load Balancer with an HTTPS Listener
In order to use them inside your EC2 vm you would need to download and configure it in your webserver. I think AWS will never allow it to avoid security breaches.
It doesn't matter how you will get a certificate. You can request free certificates with Letsencrypt using API, you can create certificates in AWS Load Balancer (but don't forget to check if AWS certificate limitations are fine for your case)
AWS LoadBalancer will be in front of your EC2 so it will sign certificates for you.
If you have an option to get certificate files (e.g. you create certificates yourself by using letsencrypt or other cert provider), you should keep certificates on your EC2 instance (if you have multiple instances, you should keep certificates on each instance). And you should use Network Load Balancer on tcp level, so NLB will just proxy your traffic which was already signed correctly.
Also you can use existing third-party solutions from AWS marketplace or non-AWS solutions. E.g. you can use AWS Kilo SLL. It is easy to setup, it will create and renew certificates for your domains. So you will have just an extra EC2 isntance which will sign all your traffic depending on the request domain. Mostly sure there are other alternatives similar solution to use, for our 240 domains Kilo works fine
For my nodejs application in Elastic BeanStalk, without Beanstalk Load Balancer I want to set up a Letsencrypt certificate and keep the classic domain provided by AWS : xxx.xxxx.elasticbeanstalk.com
After several searches I found two possible solutions :
1 - Using an .ebextensions file => to install Certbot, get a Letsencrypt certificate and config Nginx.
great post about that => https://bluefletch.com/blog/domain-agnostic-letsencrypt-ssl-config-for-elastic-beanstalk-single-instances/
2 - From an ssh connection, install Certbot, generate a certificate and Upload it to IAM AWS.
Docs AWS : https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/configuring-https-ssl-upload.html
For both solutions I have the same error message during domain verification by Certbot.
I think that the directory generated by certbot for the verification isn't accessible..
Error :
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A/AAAA record(s) for that domain
contain(s) the right IP address.
So, my question is : What's the best way to setup a SSL Certificate to get the green lock for a Node Js Elastic BeanStalk application without Beanstalk Load Balancer ?
Thank you for your help.
I finally found the solution :
I took inspiration from this script and created one using WEBROOT MODE.
I created a git to share this solution :
https://github.com/SammyHam/LetsEncrypt-SSL-config-for-Elastic-Beanstalk
TLDR:
Generate a SSL certificate (you can use a free one at https://www.sslforfree.com/), download paste the public(certificate.crt) and private key(private.key) in ./ebsextensions/certs.config and deploy to elastic beanstalk
Step by step tutorial on how to enable https on single instance elastic beanstalk environment,
with http to https redirection.
This tutorial uses Node.js as platform, but it includes instructions for other platforms too.
elastic-beanstalk-&-nginx-conf
Explanation
AWS - EB - configuration docs
Troubleshooting
Make sure port 443 is listed in the security group.
We are working on RedHat linux server with nodejs server.
While make my services ssl certified,
I got the SSL certificate from aws cli using ARN.
How could I get privatekey from aws ssl or how can I implement.
If you are using AWS Certificate Mananager (ACM) to generate the key pair and issue SSL certificates, you do not have access to the private key. The private key is managed entirely within the service.
See https://docs.aws.amazon.com/acm/latest/userguide/kms.html
Yes finally found the answer. while using load balancer for ssl certificate generation in AWS, we are no need to worry about ssl certificate things. the total things are handled by load balancer only.
what I did the wrong is, created load balancer for website in place classic load balancer for linux. Now it's working fine to me. No need to worry about ssl certificate while creating ssl certificate with load balancer in AWS
Thanks
I'm quite new to this. I have a node-express https server that currently runs locally on my machine. My simple website runs on this https sever and make xmlhttp requests to consume some APIs (as these APIs only accept requests from https endpoint). At the moment I'm using a self signed SSL certificate.
I'd like to deploy the server with html, js files to EC2 and make it accessible to the public. My questions are
Can I use AWS Certificate Manager to generate a SSL certificate, and how to use it with node-express server? Can node-express use this SSL certificate on EC2? or do I need to use this SSL certificate with Elastic Beanstalk and ELB?
I did some research but the ACM documentation said an email will be sent to the registered domain owner for each domain name in the certificate request. I don't have a domain as I plan to have users access my site using IP address. What do I do in this case?
Many thanks for your help!
You can't use an ACM certificate directly with NodeJS. You have to place a load balancer in front of your server and install the ACM certificate on the load balancer.
The ACM service does not support SSL certificates for IP addresses, only domain names. I recommend obtaining a domain name.