How to create a domain with both internal and external ips? - google-compute-engine

I was using Amazon before and there is a possibility that you can create domains like this: database.mydomain.com
Then if you ping this url from outside the server, you get the external IP, and if you ping if from an instance in the network, you get the internal IP.
How is this possible and is there a way to implement the same thing in Google Cloud? Is it about the router?
I don't know the terms for this usage. Sorry if the title is not very clear.

Related

Load IP address with data coming from a GPS device

I want to have an IP address which when pinged will load all the data sent from a GPS device. The GPS device is configured to send data to an IP address and port. I need to run a server side script to read the data from that port and display it on the IP address. Does GCP provide a static IP address to be purchased and can I use Google Cloud functions or any other GCP tool to read data from that specific port and display it on that IP address? If yes, how could I go about doing this? And is there any other way to implement this using some other platform?
Does GCP provide a static IP address to be purchased
Yes, you can create a static public IP address in Google Cloud.
Public IP addresses are free when attached to running instances/services.
Reserving a Static External IP Address
can I use Google Cloud functions or any other GCP tool to read data
from that specific port and display it on that IP address?
You have not provided enough information to answer this part of your question.
Do not mix multiple topics into one question. Create separate questions. You will get more/better answers.

Compute Engine Istance group gcloud - IP change if a specific istance go down

I have a huge problem with the manage of an istance group on gcloud compute engine.
I setting to the 1st istance of the group a static ip XX.XXX.XX.XX, this ip is connected with a Domain.
If during the scaling the first machine created was canceled, no one of the new instances will take that IP.
This is a problem because my domain go down.
I thinked to manage this by creating another separeted istance that ping the domain...and if the domain is down change (with gcloud commands) the ip of one that new istances.
I want to ask, there is someone that had found some trick to solve this issue?
Thank's guys
EDIT: Ok, LB is working, but I need to "live streaming" through that LB because this LB manage an istance group that manage the live streaming.
Now, if I set it, I can't go live (from any software, such OBS and similar) :/
So, a little recap:
I have my domain example.com
I have my istance group istance_group_example
Load balancer http_loadb
I set on the frontend of http_loadb my ip (static, not temp), then I go to cloudflare and set the static ip.
If i go to my example.com, i can see my custom page.
Now the problem is, i can access to server, but if I need to create a live streaming with OBS (for example), obs just load the connection for a while but then stop.
If i point my DNS directly to the IP of an istance inside istance group (bypassing the load balancer) everything works.
I think what you actually are looking for is an HTTP load balancer . The load balancer should take the static IP where your domain is pointing to. Form there it can forward the traffic to any instances that are in a healthy status at the moment (another thing you are looking for are health checks which more or less do what you set up with the other instance group, and ping (for TCP) or execute GET/HEAD requests regularly and, if any instance is unresponsive, it gets taken care of and receives no traffic until recovered).
So, the base architecture of your solution would be like this:
One managed instance group set to autoscale (if you need it) and autohealing (pretty much mandatory in this case, so any dead instance gets replaced by a healthy one).
A health check set up on the instance group that will keep polling the instances on the "servie port" to confirm if they are UP or not. This is important to ensure that the instances are checked consistently and terminated/recreated based on a consistent metric. The load balancer will use it's own health check too.
A global HTTP loead balancer (Network services -> load balancer -> HTTP(S) Load Balancer) pointing to a backend service that you will create. The backend service will point to your instance group and to the relevant ports for your service. Assign another health check here. This will be useful so the LB is aware as soon as one instance fails so it can take it out of the pool of destinations. If you don't specifically need it don't select session affinity.
For the LB frontend select HTTP(S) port(s) or anything you need, then under IP address select "create new static address" and name it. This IP address will be where your DNS records for your domain should be pointing at.
After the LB is ready get to your nameservers (like CloudDNS if you are managing your domain DNS from there, if not to whatever solution your registrar provides) and point the A record to the IP you assigned to the load balancer.

Accessing IP restricted URI from Azure function (powershell)

I'd like to know given a Powershell function such as:
$url = "http://AnIPrestrictedURL"
[xml]$xml = (new-object System.Net.WebClient).DownloadString($url)
with $url being an IP restricted url what are my options (if any) to be able to make this work? Is VPN an option or some other method? Would Express route (obv cost not being a factor) or point to site VPN work for this??
EDIT: To make this clearer? I have control of the IPRestrictedUrl server so in theory I could allow access to this via VPN / express route presumably without the IP restriction?? this is the point of the question?
Perhaps I should have said "how can I use an Azure Function with a service I do not want to be publicly accessible" If it matters the end service is SOLR
While the list of Outbound IPs is provided for Azure Web App (and is stable), the equivalent does not exist for Azure Function Apps. The reason is that they get scaled out very dynamically, and can end up running across many scale units, each with a different set of Outbound IPs.
So generally, you cannot make assumptions on Outbound IPs when using Azure Functions.

Displaying private HTML file from AWS S3

I'm currently hosting a static website on AWS S3. I have parts of the website that I only want AWS Cognito authenticated users to access. These parts of the S3 bucket are restricted to certain roles. As I understand it, once a Cognito user has received their temporary AWS credentials, I need to use the S3 sdk to load the restricted object (index.html) from S3 and display it in the webpage. Is this the correct approach, and once I have the object back from S3, how do I go about loading it into the webpage? Thank you!
You will need application logic that runs in the back-end to control your security and to store/retrieve data. While much of this can be done from the browser, it is open to hacking. Therefore, you need your access control logic in the back-end.
Option 1: API Gateway and Lambda functions
You can have a static web page served out of Amazon S3, which makes API calls to Lambda functions via API Gateway. This is known as the serverless model.
Here's a sample diagram from the Serverless Code website:
Basically, Lambda functions receive the request, determine whether the user is authorised, determines what they would receive back (eg a pre-signed URL to a different page) and sends it back to the web page. The benefit of this design is that it does not require any servers.
Option 2: Amazon EC2 servers
Alternatively, you can run Amazon EC2 instances fronted by an Elastic Load Balancer. This is traditional application design allowing you to use many different frameworks. However, there is an on-going cost for the servers even when nobody is using your application.

New host - 404 Error

I am a newcomer at the web part of programming and I was given a host. I uploaded a simple index.html file with one header(It is correct). If I then try to connect with the nameserver/ip (gotten with PuTTy) , I get an 404 error. I have tried many different stuff about folders , but I could not fix anything
The nameserver IP address is almost certainly not your hosting IP address. The nameserver is the server (probably owned by your host - but possibly an outsourced service) that converts the human readable domain name (such as www.domain.com) to an IP address the computer can connect to (such as 198.252.206.16 - the IP 4 address I get for www.stackoverflow.com). It acts as a giant lookup list of domain names and IP addresses, much like a telephone book or Yellow Pages.
Moreover, as your host will almost certainly be hosting many domains (tens or possibly hundreds) per server, you will need to use a domain name when attempting to connect to your web page - this will be needed for Apache or IIS to know how to route the request/which content to return to the browser. It will do this using the request header sent by the browser when requesting the page. If you are testing locally then localhost/127.0.0.1 will be good enough if you have a single site registered/single set of content in a wwwroot directory (or equivalent). Similarly a virtual server or dedicated server may well respond to requests by IP address if it is the only site/application registered on the server.
To use another real-world analogy, it is a bit like addressing an item of post to a town or village - without including the recipient name, street or house number - and then expecting it to be received and to get a response.
Some hosts provide temporary domain names for you to use before you purchase your domain name or whilst the domain name details are propagated to DNS servers around the world. This usually looks something like-
http://your-user.your-host.com/ or http://server.your-host.com/your-username/
If your host offers such a service then this should normally be detailed in their self-help pages, or the admin area where you set up the site. Clearly such a domain is not intended for "production" use, and you should purchase a domain name before using the site for anything other than testing - if only to allow you the flexibility to move to a new host in the future.
This is not a question for StackOverflow users though, and I strongly suggest you consult your host's documentation or contact them for further assistance.