Keeping the same Public DNS for an EC2 Instance - amazon-web-services

I understand, that a static IPv4 addresses would be more expensive for AWS, so it changes every time I restart the instance. But the Public DNS could be static, so I would not have to change the address in all my applications, after restarting the Instance.
Can I statically set the Instances Public DNS to something like "MyChoosenName.eu-west-1-compute.amazonaws.com"?

It seems that AWS now allows keeping a static public IP address with a EC2 Windows or Linux instance by associating an Elastic IP address with the instance.
Check out their webpage for how to "allocate and associate an Elastic IP address with your EC2 Windows or Linux instance".

No its not possible
Because each public ip address in AWS is binded to DNS, so what you
are attempting add sub-domain to the
"eu-west-1-compute.amazonaws.com" which is not possible you are not
owner of the domain provider.
The thingh you do is bind the public to some other domain which you own like
Mychoicename.abc.com like we do for other domain bindings either in
AWS route53 or other domain providers.

Related

AWS EC2 Rescue - Get old Public DNS back

I ran the rescue program to generate a new private key for my AWS EC2 instance. There seems to be a new instance with the same old instance-id but a new public DNS. Is there a way I can get back to my old public DNS? Everything I had was written to call the old public DNS (server name url) .... Thank you. (AWS documentation is very hard to follow.)
The only way to 'keep' a public IP address is to create an Elastic IP. This is a static IP address that is associated with your AWS Account and can be assigned to an Amazon EC2 instance.
Typically, it is best to avoid requiring a specific IP address. This can be done by using a DNS name that resolves to an IP address, thereby allowing the IP address to change.
However, sometimes people need a static IP address for whitelisting (eg calling an API from a 'known' IP address). Elastic IPs are available for this purpose.

AWS instance accessible by IP only and not with domain name

I have an instance running on AWS. I have stopped it and then restarted it after few hours. Now I am unable to access my website by a domain name but it is accessible by its ip
Looking for a solution so that I am able to access it with domain name also.
As this is your personal domain, the likely scenario is that when your instance rebooted the IP address changed.
You can validate this by comparing the public IP address in the AWS Console to the IP address entered in your DNS configuration for your domain.
This is expected behaviour for the standard public IP address for EC2 hosts, if you want to resolve this you will need to create an elastic IP address and associate it to the instance you have.
Once this has been associated update your DNS record to use the new public IP that has been assigned (the EIP). This will then allow you to reboot your instance without the risk of losing your IP. In addition be aware that based on the TTL of your domain you will need to wait for the DNS to propagate.

assign a domain name to ec2 instance w/o elastic IP

I registered a domain name with AWS Route 53 as mydomain.com. Is there anyway that I can assign e.g. ns1.mydomain.com as a public hostname to an EC2 which does NOT have a Elasti IP?
Thanks
You can assign the domain name to any IP address of an instance. However be aware of the following limitations:
If a domain name is assigned to a private IP, it will not be connectable without network access to that IP
If the domain is assigned to a non-elastic public IP if the instance stops and starts you would lose the public IP so would need to update the DNS resolution.
If you have a public facing application, but want to keep network traffic that directly connects to the instance private you should look at using an ELB in front of the application to provide a security boundary between the internet and your application.
Utilize a load balancer in front of the instance and assign the public hostname to the load balancer.
Use S3 webpage redirect and assign the hostname to the S3 URI.
If the problems is that you don't have any elastic IP's left, you can request for more. This should be resolved within about 15 minutes.

Access EC2 machine with local IP instead of elastic IP

I have an Amazon EC2 instance that I have been using for production and for some weird reason I did not use an Elastic IP.
Now that I want to use an Elastic IP, it seems AWS doesn't allow connection on the old IP. In my use case I need the instance to be accessible through both IPs. Is this really possible?
No. You cannot use the old public IP once you associate an elastic IP. Remember you have only one network interface, you cannot have 2 public (routable) IPs associated with it.
From Elastic IP Address Basics
If you associate an Elastic IP address with the eth0 network interface
of your instance, its current public IP address (if it had one) is
released to the EC2-VPC public IP address pool. If you disassociate
the Elastic IP address, the eth0 network interface is automatically
assigned a new public IP address within a few minutes. This doesn't
apply if you've attached a second network interface to your instance.

How to develop DNS for instances and that DNS names are not accesed outside Amazon Web Services cloud?

I have many instances in my amazon web service cloud now i want to develop DNS for server and all instances will have elastic IP. Now i want to do something by which DNS cannot be acceded outside i.e. want to develop DNS only for internal instances.
Do you want to run DNS on EC2 or outside the network? Remember EC2 instances with an elastic IP address have an "internal" (natted) IP address. Do you want DNS to return the internal IP addresses or the elastic (public) IP addresses?
I think the easy solution is this. On whatever machine or instance you run the DNS server on, put up a firewall on that box such that only AWS addresses (e.g. in the 107...* and 50...* range) are permitted. Or restricted to just your instance/elastic IP addresses. Configure the IP address of this DNS server to be the primary DNS server for your other instances.
Another easy solution is to run all your instances on a VPC. All the instances that need to be accessed from the public can still have elastic IP addresses. Then run a DNS server on another instance on this VPC - but without an elastic IP address. This means your DNS server would be at 10.0.0.3 or something. That IP address won't be accessible to the outside world, but is internally reachable by machines within the VPC. I'm not sure of the network topology between your instances are, but if they only need DNS to communicate between each other, then you could even have a public DNS server that returns the 10.x.y.z addresses for instances on the VPC.