After Shutting Down compute engine instance do we get new system or the same old one with new IP? - google-cloud-platform

I had a compute engine instance, I shut down that instance from command line. Now the thing is when I started it back the IP got changed, which I guess it was because it was ephemeral.
Now I wanted to ask as I am having now new IP. Does my system got changed or just my IP, because if my previous system is changed then I think that all of my data which I had on that compute engine will be still there and if my previous system got assigned to a new person then maybe he can see my data which will be a security breach.
The second question is, is there any way I can get my previous IP assigned to my new instance which I had before.

You're conflating a couple of things here. Networking in GCP is a purely software-defined configuration. As such, the IP of your machine is defined by software and is in no way dependent on things like your instance itself or the disk attached to the instance (where your data actually lives).
To answer your actual questions:
When the machine is restarted, a new ephemeral IP is assigned. Your data is on the disk attached to the machine, and nobody else has access to it.
You have no control over ephemeral IP addresses. If you want to maintain an IP address between restarts, you need to reserve a static IP and assign it to your instance.

Related

GCP - error "External IP Address already in use" when updating network interface of a vm

I want to change the network interface of a vm.
Created a new vpc network network-A with subnet-A
Stopped the vm.
Edit the vm instance details to change from default to network-A
There is a drop down option to create external IP address
Created one network-A-ext-IP
Clicked Save
Error: ..."External IP address already in use"
VM not updated
I checked under the external IP address page, network-A-ext-IP is not attached to any vm and it is not in use.
I couldn't update the vm instance with the new network.
I am relatively new to GCP, I don't understand this behaviour. Can someone help to shed some light on this?
If you cannot attach an existing (and not being used by other VM) static IP to a new (or existing) VM is not normal and possibly a bug. This should not happen.
In this case I recommend for you to contact GCP Support (paid service) or file a bug on IssueTracker.
You can try doing the same thing in another zone and see if it works. In any case filing a bug is a good idea.

Assigning new IP to a VM each time

On GCP, I want to change external IP address of my VM instance several times in a day and in my project VM needs to be assigned new IP address each time. However, regardless of using ephemeral or static IP, when I try to change IP, there are only 3 or 4 different IP addresses. After 4 times change, the loop backs to start so the IP has been assigned before was assigned to VM again.
Is there a way to assign a new IP address to VM each time?
In this scenario you can use protocol forwarding in order to assign multiple/different external IP addresses to a VM instance. Then When traffic is sent to an external IP address that is served by a forwarding rule, the forwarding rule directs that traffic to the corresponding target pool or target instances.
As per document you can create up to 50 forwarding rule objects per project.
I think (don't know) that this isn't possible.
You are being loaned public IPs from Google's pool and, technically these are assigned randomly (you won't always get these IPs) but, over the timeframe you've monitored, you detect there's a pattern and the behavior is insufficient for your needs.
It's unclear why you need random IPs -- I assume random DNS naming won't suffice for your use-case -- you may want to submit a feature request to Google's Issue Tracker
Given that you detect a period of 3-4 IPs, you could temporarily hold these on VM interfaces and, once you obtain a different IP for your app, you could release the others?

Google Cloud Redis - IP Address changed without warning

TLDR: I could use some advice on how to setup Redis for production use on GPC, it just switched IP addresses on us randomly, and there is nothing in the documentation about that / I have no idea how to build a stable solution with that possibility.
Background:
We've been using google cloud for a few years and had a stable Redis Memorystore instance on the 'Standard' Tier.
In the past few days, our web servers started slowly crashing every so often. After investigating, something was locking up when connecting to celery / Redis, and we found that all our config files had 10.0.0.3 as the Redis instance, and the IP address for the server was listed as 10.0.0.4. This hasn't changed ever, and our configs are in git so we're sure they were unchanged.
Since Celery won't boot up with a bad connection we know it was correct on Tuesday when we pushed up new code. It seems like the server failed over and somehow issued an IP address change on us. As evidence,
Our graphical usage bizarrely change color at a specific point
Which matches our error logs "[2020-06-16 03:09:21,873: ERROR/MainProcess] Error in timer: ReadOnlyError("You can't write against a read-only slave.",)"
All the documentation we have found says the IP address would stay the same, but given that didn't happen, I'm hoping for some feedback on how one would work around a non-static IP in this case on GPC
Memorystore does not support static IP address. Some scenarios where IP address change can occur are restarts or when connection modes are changed.
From review of the Memorystore for Redis networking page, when using direct access connection via IP address your project will set up a VPC network peering connection with Google's internal project, where the instance is managed. This will create an allocated IP range for Memorystore to use for the instances, this can either be provided by you or picked from the available space (will be a /29 block by default).
On the other hand, Memorystore for Redis exposes the uptime as a metric that is available through Cloud Monitoring (formally Stackdriver). This can be used as a health check for the instance as you will be able to determine if there has been a restart or points of unavailability.
Following the point above, you are able to set up an alert on the uptime metric directly in Cloud Monitoring. Unfortunately there is nothing specific to IP address changes though.

New IP still banned using Elastic IP

I am trying to make a web scraper but my ubuntu instance is getting banned. I think I am scraping the website a little too fast. I've slowed down the requests but I am still banned. To fix this I assigned the instance with a new IP by releasing my IP and reassigning it one with Elastic IP but it is still banned. How can I assign a new IP for my ubuntu instance to stop it from being banned? It does not seem like reassigning IPs with ElasticIP is the solution.
I dont want to terminate my instance as I would have to setup the new instance again. This instance is under a VPC as well
Unless you know for sure that the website owner is banning just specific IPs, then getting a new IP probably won't help.
There are plenty of websites that block the entire AWS IP range.
When you stop an instance and start it again, you get a new ip address and the entire setup is intact. You wont have to set it up again

Is there any way to turn a non-elastic IP into an elastic IP on aws?

I have done some research and don't think it is possible but figured I would ask on here just to be sure.
My predecessor decided to use the public and private IP of one of our database servers in an extremely large amount of places, now that we are going to be resizing this DB server going through and changing all of those IPs over would take a large amount of time and the possibility of missing one is pretty high.
I am wondering if it is at all possible to take the current IP on the server ( which is not elastic ) and some how convert it to an elastic IP. To clarify I am not looking to add a new elastic IP to the server but rather take the IP that is currently assigned to it and make that elastic. If this is not something that I can do using the SDK / Console is it something that Amazon could do behind the scenes if we were to get support?
Thanks !
No, it is not possible.
The Elastic IP addresses are a separate pool from the Public IP addresses. There is no public means to convert a public (or private) IP address to an Elastic IP.
Standard Amazon support is unlikely to be able to make such a switch for you. While technically an Amazon network engineer can probably make such a switch, it is very unlikely that support could make that happen.
If this is not something that I can do using the SDK / Console is it something that Amazon could do
behind the scenes if we were to get support?
Amazon can create a reverse DNS record for a mail server manually and is known to implement features that users request, so I guess it might be worth asking. I would give it a try.
So long as you do not terminate the instance, its static IP should remain assigned to it per Amazon documentation (https://aws.amazon.com/articles/1346).
now that we are going to be resizing this DB server
You can resize the instance and keep its static IP without terminating it (and thus without losing the static IP). The moment you terminate that instance, you lose the static IP, so resize it without terminating it.