Private nameservers with Amazon LightSail Instance with WHM / cPanel - cpanel

i recently setup a Amazon lightsail instance with WHM / cPanel on it, i am trying to use it for my reseller hosting and for that i need some nameservers that i can provide to my customers.
i have a domain for nameservers purpose, i can register glue records / private nameservers
i am confused with setting them up as private nameservers require 2 different ips for ns1 and ns2 meanwhile i can see that amazon instance only allow 1 static ip with 1 instance.
I've tried googling it up but can not find something that provides a clear answer to this issue.
If anyone have idea on this, please share.
Thanks.

Related

Restrict Lightsail machine to be accessed from cloudfront

I have a website (https://www.cakexpo.com) hosted on lightsail. Few days ago, we faced a DDOS Attack on the IP which forced me onboard my website to cloudfront.
I moved my website to cloudfront, yet my ip address is still publically available and making it vulnerable for more attacks again.
I am trying to understand how I can hide my ip from public access.
I found that in vpc, you can get the list of corresponding cloudfront ips and whitelist them in security group., which I tried
It worked for some time, but later on I realised that cloudfront uses lots of Ips which are not listed here and thus not whitelisted in my security group.
This makes my site intermittent unavailable.
nslookup shows a different ip, which is not listed in the above list, and this link says that there 190+ ips associated with Cloudfront, which security group cannot handle, IMO. https://ip-ranges.amazonaws.com/ip-ranges.json
Finally I ended up reverting the config and make my IP public.
Is there any other way to hide the lightsail machines from public access?
you can do this in 2 ways.
easy Way: Create a ngnix reverse proxy instance in lightsnail, allow access to ur lightsnail main instance only from that reverse proxy instance. then Create a distribution instance (with is cloudfront for lightsnail) then point as Origin the reverse proxy instance.
Hard Way: vpc peering to Aws, from there you Create a cloudfront instance. allows access from it.

Is there a way I can point my sub-domain to AWS lightsail?

I have a domain registered with Site-ground and created a sub-domain as well.
After that I created an AWS lightsail WordPress site that gave me an IP.
Now my question is, is there a way to point my sub-domain to AWS lightsail?
Create a static IP in Lightsail, and attach it to your instance.
Update the DNS in siteground by creating an A record that maps the subdomain you want to the static IP in lightsail.

ssl certificate for aws

I have a https web app running on my aws ec2 instance.
https://ec2-52-91-100-69.compute-1.amazonaws.com/
I need to get a ssl certificate for the same so that the scary warnings do not appear.
How can I do this? I tried to buy a ssl from clickssl.com but their helpdesk emailed me with the following:
"You completed enrollment process for domain name
ec2-52-91-100-69.compute-1.amazonaws.com.
I believe you cannot get SSL for this domain name because root domain
name amazonaws.com is Amazon property."
If this is the case is there no way to get a ssl certificate for my application? I dont believe thats the case.
Any help will be appreciated.
First you need to register a domain through a registrar (e.g. GoDaddy or Amazon Route 53). Next you assign an Elastic IP to your EC2 instance and use your registrar's DNS tool to make your domain point to the Elastic IP address. Then you can request an SSL certificate for your own domain.
You do need to register a domain, or use a subdomain of a domain you already have registered. You do NOT need to use an Elastic IP - they are limited and eventually (if you use multiple domains in your AWS account) you will run out. Instead, you can use a CNAME to point to the AWS name (e.g., ec2-52-91-100-69.compute-1.amazonaws.com).
Once you have that set, use Let's Encrypt to get a free widely accepted certificate. There are plenty of tutorials on the installation process - try:
https://ivopetkov.com/b/let-s-encrypt-on-ec2/
Just noticed the original question is OLD - which means (among other things) that Let's Encrypt wasn't even an option at the time. But for anyone who stumbles across this question now, it is a great solution.

HTTPS on Amazon EC2 for OwnCloud

I have a question which I hope somebody can answer for me.
My situation: I have an Ubuntu Server running Apache2 on a EC2 Amazon instance, which is serving an OwnCloud instance.
My goal: I want to deploy HTTPS on this instance. I already configured the security group to allow HTTPS traffic from anywhere (as the server should be accessible from anywhere on the internet). We already have a domain name bar.com registered at another domain hosting company. But we want to point foo.bar.com to this owncloud installation.
My questions:
1) Which IP-address do I use to configure the DNS at this domain hosting company. Because the public ip-address and public DNS of the EC2 instance is renewed every time the instance restarts.
2) How do I generate the SSL certificate for HTTPS configuration of Apache2? More specifically, which common name (CN) do I need to put in the certificate. Because the public dns of the EC2 instance is changing on every restart. I think if I put the foo.bar.com CN in the certificate that the browser will throw a certificate error once the user gets redirected from foo.bar.com -> .compute.amazonaws.com, am I right?
In short: how do I deploy https on a EC2 instance at Amazon AWS with a dns at a third party domain name service?
To deal with the changing public ip address you've got two options, first and (for simple situations, best) go to the Elastic Ip Page, get an eip and associate it with your instance, this association and hence public IP will hang around even after start/stop. You can even move the eip over to a different machine if you need to. This option is very cheap (you only get charged for an eip if its not attached to a started server). You're then safe to point your dns at the eip. The alternative option is much more powerful and that is to use elb (load balancing) but it also involves a fair amount more work to setup.
I assume if you're asking about cn's you dont really want a "how to" on creating an ssl cert (please correct me if I'm wrong). For the cn you just use the domain name - it doesn't matter what ip address the name resolves to the cert is for the domain. If you have your own domain to point at your eip you dont need to care about the machines public hostname. A user will never see it.

Redirect of domain to Amazon EC2 without Route53

I have a website hosted in Amazon EC2.I have set my A record to point to my Elastic IP. I have also set my www to point to A record.
The problem is that both homepages exist now (the one with the domain I have in godaddy and the one with the amazon url)
I would like the ec2-.....compute.com to redirect to the homepage of my domain.
Could you help me on how to do it? Should I use somehow httpd.conf?
I am not sure how you would do it with httpd.conf.
But this is the alternative to make your redirection to your instance
Attach an Elastic IP to your instance, go to your domain management tools [ GoDaddy or Network Solutions ] and set that in your A record. [ Recommended ]
Take the public DNS of your instance, go to your domain management tools [ GoDaddy or Network Solutions ] and set that in your C record to www sub-domain
I know this question is bit old. Just wanted to know if anybody has found a solution to this question. I registered a domain in GoDaddy and have setup a VPC in Amazon EC2. Tried several means like pointing A record to Elastic IP address and updating CNAME record. But could not make my domain accessible.