I recently moved a small R project from a regular EC2 instance to an instance behind a VPC. I installed rstudio-server as normal, and it seems to be running. However, unlike a regular EC2 instance, there is no public DNS to connect to. (There is a public IP address, but going there doesn't seem to do the trick.)
In this case, what browser address should I go to to access rstudio server?
Many thanks!
You have launched the instance in VPC. Here is the check list:
When launching the instances in VPC, make sure you launch it in the public subnet of your VPC. Else it will not be accessible from outside
When launching the instances in VPC (presuming public Subnet), do ensure that you check a box which says something like "assign a public IP address to the instance" at the time of creating the instance. By default this is not checked. So if you fail to check this box, then Instance will not have a public host name. You can however, assign an elastic IP later on.
Make sure you VPC security groups are configured properly to allow necessary incoming/outgoing access. In your case, incoming access on port 80 is/443 is essential.
Related
I built a new vpc and subnet, in a region i havent used before. I added a linux ec2 instance and wanted to ssh to it, but the connection times out. I've been trying the same steps in another aws account, owned by the same company, and i get the same results.
I've tried adding my public ip to the security group, instead of all ips, no change.
The ec2 instance does get a public ip, but i just cant seem to connect to it. I even tried trusty telnet, just to see if the port was open, it is not.
When creating a new VPC using the "VPC and more" option, and the number of public subnets is not zero, an Internet Gateway will be automatically provisioned as part of the network:
If, however, you are manually creating the VPC and the subnet, then you will need to also add an Internet Gateway if you want the VPC to have Internet access.
Without an Internet Gateway, the VPC is guaranteed to be unreachable from the Internet. This is very useful when building private networks for internal use (eg development systems).
I have 2 EC2 instances within same VPC and same subnet, both have same security groups attached to them. But 1 instance has public ip that was allocated when launching the instance (lets say public-ip-instance). The other one only has private IP, but I created and attached an elastic ip(lets say elastic-ip-instance). So both instances now have public ip's.
But I can access the ec2 instance with public ip that was allocated during launch and not the instance with elastic ip. Both have same user data script. I'm just trying to access the instance through browser using the instance ip address.
I've tried searching everywhere and seems like there shouldn't be any difference in accessing an ec2 instance over elastic ip, but it doesn't seem to work. What is needed to have an instance access over elastic ip or am I doing something wrong.
It appears your situation is:
You launched an Amazon EC2 instance with a User Data script that installs a web server
When the instance was launched, it was not assigned a Public IP address
You later added an Elastic IP address
You are unable to access content via HTTP on that server
When an EC2 instance in a public subnet does not have an IP address, it is unable to access the Internet. Therefore, when your User Data script ran and attempted to install the web server, it could not download the software from the Internet. Therefore, the web server was not installed on the instance.
You can correct this by logging into the instance and running the install script again. It will work this time since you have added an Elastic IP address.
Alternatively, terminate the instance and launch another instance, being sure to assign it a public IP address on launch.
I am new to AWS and tried to create an EC2 instance.
I have a domain and ready to modify the A record to the associated EC2 instance.
I found an article that said an elastic IP is required for associating a production domain.
But AWS provides a public IP and it is accessible on the public internet too (i know it changes after restart, just assuming its okay to modify the A record after the machine is restarted - actually it is not restart very often).
In this case, is it a must that to assign an elastic IP to the instance (this instance contains no load balancing, it is only a simple single instance)?
If yes, why is it necessary?
An Elastic IP (EIP) is not necessary provided that you understand the limitations of public IPs. You may not reboot your instance, but AWS might for any number of reasons. This means that the public IP address could change when you are not expecting it.
When an EIP is assigned to a running EC2 instance, there are no charges for the EIP e.g. it is free. Therefore why go thru the hassle of needing to monitor your public IP address.
I have an EC2 instance that had a dynamic public IP. Due to changing requirements I assigned a new Elastic IP. I shut down the instance and restarted it. The console now shows the new IP and no longer the old, dynamic one.
Problem is now I can not ping nor curl/wget to the public Internet any longer from this instance. I do have an outgoing rule for port 80 and 443 setup. I also allow ICMP in both directions.
I have a load balancer setup in another instance. That instance can access the problematic instance over the private IP no problem.
I did notice that while all my other instances list their public IP (dynamic or Elastic) the instance in question lists "ec2-x-x-x-x.compute-1.amazonaws.com". Not sure what to make of that...
What could be my issue?
If you are not seeing the public IP show up in the console for the system, but instead are seeing the hostname as you mention, it means that your public IP is NOT assigned to the instance. Suggest you go to the Elastic IPs section of the console and re-attach the EIP to the instance.
Note, if you are not running in a VPC, when you reboot the instance, the EIP will drop off the instance.
I am launching an instance into my VPC on AWS and assigning a security group to that instance that allows access to the relevant ports (including 22 for SSH) from the CIDR block of my VPC as well as my personal IP address. When I launched the instance, I chose NOT to assign a public IP address, thinking that I would be able to access the instance using the private IP address. However, when I try SSH'ing into the machine, it simply hangs and fails to connect.
So, what do I need to do to be able to SSH into the instance within my VPC without assigning a public IP?
You would need a bastion host in the same network to jump into that machine. The bastion can be started on demand and use ssh agent forwarding to be transparent and safe. Using a VPN or Direct Connect to reach the private network would be more complex alternative, but useful if more hosts need to connect.