External IP is not get visible on my compute engine dashboard - google-cloud-platform

External IP does not get visible for my one of the compute engine

You may have not reserved an external static IP. You can do it through the Google console using an ephemeral IP address1 or assignnating one custom IP address mannually.2
If your issue is more related to the Google Console UI, try to check if there is a reserved external IP address for your particular VM instance by using the Google Shell and the following command:
$ gcloud compute instances list
You will need to provide more details about whats exactly is your issue.

Related

Assigning domain name to Google Cloud VM

I'm attempting to assign a domain name to my Google Cloud VM external IP. I was following some walkthroughs and getting a bit confused. I set up apache with a simple "Hello" message when you visit my external IP. The walkthroughs I'm following are providing steps to reserve a new static external IP and creating a DNS zone.
Could someone provide clarification on why I would need to secure a new static external IP address when it appears I already have one assigned?
As discussed by #Ferregina Pelona in the comment section. The public IP that your VM already has is an ephimeral one which means that if the VM is stopped or restarted, there is a possibility this public IP changes. The problem will be that if it changes, your DNS will continue pointing to the old one which means your site will be not accesible until you update the DNS with the new IP. Reserving the public IP will warranty your VM always has the same IP.
Also, added by #DazWilkin. it should be more explicit in the documentation but I assume (!) it's an ephemeral IP. I submitted doc feedback for this.
I assume you're following a guide like [1]
The tutorial demonstrates the following steps when assigning a domain to a VM which would act as a server:
-Register a domain name using Google Domains or Cloud Domains
-Create a virtual machine (VM) instance
-Run a basic Apache web server
-Set up your domain using Cloud DNS
-Update name servers
-Verify your setup
However, there is a very important note that I believe clarifies completely the scenario you faced and the questions regarding this which states:
Note:By default, the VM instance that you create receives an ephemeral external IP address. Ephemeral external IP addresses are lost whenever the VM instance shuts down or reboots for any reason (for example, maintenance). To avoid shutdowns and reboots, use a static external IP address for web hosting. For instructions about how to reserve a static external IP address, see Reserving a static external IP address.
My suggestion would be that you try always to find an official docummentation according to the configuration/products you're expecting to use so as shown in this section, these are the advices that could avoid you yo fall into errors while moving forward. I hops this info make sense for you...
Cheers,

Instance is running but ip shows nothing

I have a google cloud platform, with a VM instance and a SQL. Today they got suspended because the free trial ended. I restarted them both and now they are running. But when i try to go to the ip of the VM instance in my browser, it says This site can’t be reached and "refused to connect". Note that i know nothing about Google Cloud and instances, i just need to have my moodle up and running again.
I tried securing that it allowed http and https in the console. (Ref to this)
The external DNS setting is correct.
And i checked if it was on localhost (ref to this question)
Please help.
If you were using an ephemeral external IP address, that address has been release when the instance was stopped.
If you were using a static external IP address, that address was also released the moment your trial expired, hence reserved IPs generate costs.
When your re-started the instance, probably it received a new IP address.
Check for the external IP address that the instance is currently using and try to use it.
You can see the instances running in your project here: https://console.cloud.google.com/compute/instances
The resources you created during the trial are stopped and If you upgrade within 30 days of the end of the trial, you can restore the resources you created during the trial.
https://cloud.google.com/free/docs/gcp-free-tier#end
What happened is that all resources you created during the trial were stopped.
As Neo mentioned, if you didn’t have your external IP address reserved, the IP was released when the instances were stopped and when you started your instances again, GCP provided a new External IP.
You can check what External IP you have on the External IP addresses, and try to access your moodle through this new IP.
To avoid this problem in the future you can promote your ephemeral external IP address, you can use this guide as reference or follow the next steps:
In the Cloud Console, go to the External IP addresses page.
In the Type column, change the address type to Static for the IP address you want to promote.
Provide a name for the new static IP address and click Reserve.
In this way, the next time you stop your instance you will keep your IP.
Nevertheless, you are not charged for static external IP addresses that are assigned to forwarding rules.
Also you can consult the following documentation for External IP address pricing, in which the documentation provides you pricing for static and ephemeral external IP addresses.

Google Cloud managed instance group issue with plesk

I'm losing my mind over this so i thought I would ask about it. I have a VM instance that I was asked to put into managed instance group so that later on we can stuff like load balancing and Cloud armor.
This Vm instance has plesk panel that is configured with a website on it which is configured with a public domain to point to it.
I shut down the vm instance, create an image, then create instance template and finally create the managed instance group. The problem is that the instances that launch will have their internal and external ip addresses different then the original vm obviously so none of them will work until I ssh inside the vm instances and do some repairs like : Plesk repair all and that doesn't fix everything.
Essentially lets say original vm has internal ip : 11.11.11.1 and external ip : 20.20.20.1
when i create the managed instance group the first vm launching from the template will have
internal ip : 11.11.11.2 and external ip 20.20.20.2
but the config for plesk was setup for the first set of ips, so every instance created will be usesless as a webserver till they are fixed
Ive watched a lot of the tutorials on Managed vm instance groups, but none of them solve this issue. I'm trying to create a managed instance group of webservers that will go into a load balancer later.The tutorials online show just some simple start up script with one page being load balanced...
Any help is appreciated.
Thank you
As long as you want to host a single VM in Managed Instance Group, you can create an instance template that is bound to specific internal and/or external IP.
You can follow by analogy this example of creation MIGs with fixed IP addresses:
https://cloud.google.com/vpc/docs/special-configurations#configuring_the_gateways
As I don't know Plesk, please clarify in your question:
whether you need to host more than 1 VM in the group
whether Plask needs to know each individual VM by its both external & internal IP. It seems more natural to point Plesk to the loadbalancer's IP that routes the traffic to one of the VMs in the group.
why the solution with registration in startup-script didn't worked out.
Use :
plesk bin reconfigurator --autoconfigure
place on startup script of instance template

Rotating IP on Google Cloud

I have one instance on Google Cloud Compute engine. By default, it has 1 ephemeral external IP address.
I need to constantly change this external IP, ideally every 1-2 minute.
Is there any way to make this "IP rotation" by running some code?
Also, once new IP assigned, is there any way to get this IP by the code from the previous question and save it in external DB?
Update: Use case is to provide back-connect IP proxy server with IP rotation
This likely can be accomplished with add-access-config. As the documentation reads:
gcloud compute instances add-access-config is used to create access configurations for network interfaces of Google Compute Engine virtual machines. This allows you to assign a public, external IP to a virtual machine.
This lists external IP addresses (and indicates if they're currently assigned):
gcloud compute addresses list | grep external
Adding all IP adresses to a NIC and then rotating the address of a service might be less disruptive.

GCP: How to Retain resource on delete deployment?

I want to retain External IP address created 1st time and use it again after deleting and recreating deployment.
I searched in documentation but did't find anything useful.
Is there any way I can specify in .jinja file to retain resources?
In order to use always the same IP in Google Cloud Platform, you need to reserve a static external IP.
After that you should define your service to use that static IP.
type: LoadBalancer
loadBalancerIP: "YOUR.IP.ADDRESS.HERE"
Keep in mind that in Google Cloud Platform every time the VM instance is restarted it will get a different random external IP assigned. The same goes for GKE service, if you recreate it, it will get a different external IP each time it gets created. If you want to have the same IP, you will need to reserve a static external IP.