How to Use Cloud DNS to Expose Your Web Page to Internet?
Last Updated :
16 Apr, 2023
Cloud DNS is a service provided by Google Cloud Platform that allows you to map domain names to IP addresses. It is a popular technology that enables you to manage a domain name system (DNS) in the cloud. It is offered as a service by various cloud computing providers and allows you to manage their DNS settings and records through a web-based interface provided by their cloud provider.
Pre-requisites: GCP
Steps To Create Cloud DNS
Step 1: Go to your Google Cloud Platform(GCP) dashboard after you have logged in to your account. Your screen would look like the following.
Step 2: Create a Virtual Machine with Apache 2 Web Server
First, go to the navigation menu -> Compute Engine -> VM Instances. Click create.
Step 3: Create an instance
Here we will create a virtual machine with Apache 2 web server on the Google Cloud Platform. In the following fields fill the required details like your instance name, region, and machine configuration as per your want.
For the firewall, select Allow HTTP traffic.
Step 4: Startup Script
Next, install a startup script that will add Apache 2 and change the default web page. Here's an example of a simple script to install Apache 2 and replace the content of the default index.html page:
apt-get update
apt-get install -y apache2
echo "Welcome to tomek.tk" > /var/www/html/index.html
Enter the above in the management -> Automation -> Startup script section.
Step 5: Completing VM Instance
Navigate to the networking section and in the network interfaces, change the default settings for the external IP address. Create a reserved IP address and give it a name, such as "tomektk-ip," so it's easy to recognize what it's about. This will give you a static IP address that will not change between boots. This is important when you're planning to use this IP in your DNS configuration. Otherwise, there is already set one by default.
To create the VM, click Create.
Step 6: Instance Created
After a short while the instance starts and is ready. It will be listed on the VM instances page with a green status icon. Also, copy your External IP address for future use.
Step 7: Setting up Cloud DNS
Now, let's configure Cloud DNS. Navigate to the networking section and then to networking services and Cloud DNS.
Step 8: Configure DNS
Proceed with creating a new DNS zone and give it a unique name. Set the DNS name to your domain name. Click Create.
Step 9: Add Record Set
Add a record set of type "A" that will point the root of your domain to the IP address you reserved earlier. Add one more record set, this time of type "CNAME" that will point the prefix "www" to your root domain. Set the canonical domain name to your domain name with an extra dot at the end, such as "tomek.tk."
Step 10: Configure Domain Name Servers
Finally, configure your domain name servers. If you are using Freenom, go to the "Manage Domain" section and edit the name servers. Copy the name servers provided by Cloud DNS, which will have a dot at the end as shown in the image.
Do the same for others as well and the final will look like this. Click Change Nameservers. Save the changes and wait for the changes to propagate.
Step 11: Exposing Your Web Page to the Internet
Try opening your domain name in a web browser and verify that your web page is displayed.
Similar Reads
How to Use Cloud Storage to Store Your Data?
In today's fast-evolving world where data is the new currency, it is important to manage and store data appropriately, whether you are a business professional, a student, or simply someone who values your data and privacy. Cloud storage is one solution to it and is more effective than the traditiona
9 min read
How to Integrate Cloud CDN To Your Project?
The cloud refers to the telecommuting servers on the internet that manages and handles all big data and applications. It is internet-based computing where shared resources and information are given to computers on demand like a public utility. Cloud is surrounded by different models like IaaS, PaaS,
7 min read
How to Use Cloud NAT For Outbound Internet Access on GCP?
NAT Gateway is a Network address translation gateway that enables multiple devices to access a public network through a single IP address. It is mainly used to conserve registered IP addresses and use private IP addresses instead. Cloud NAT is used to expose internal private resources to the interne
3 min read
How to Use a CDN to Improve Web Performance
The website speed is really important for user satisfaction and SEO. One powerful solution to enhance web performance is leveraging a Content Delivery Network (CDN). By strategically distributing content across multiple servers worldwide, CDNs minimize latency and accelerate page loading times. In t
12 min read
How to Use Azure Traffic Manager to Manage Your Domain Names?
In the modern-day digital landscape, managing domain names and ensuring the high availability and performance of your web programs is paramount. Azure Traffic Manager is a powerful Azure service that allows you to gain this goal by intelligently routing site visitors across multiple endpoints, impro
6 min read
How to Install CloudPanel on Ubuntu?
CloudPanel can be self-hosted on Ubuntu and is a very effective software for the administration of web hosting platforms. CloudPanel is a type of open-source control panel that primarily facilitates the tasks of an administrator and developers and that is used by hosting providers as well. This guid
3 min read
How To Host Your React Application In Aws S3 ?
Hosting the react application on the AWS S3 offers the cost effective and scalable solutions for the deploying the static web applications and it can provides the reliable infrastructure for the storing and serving files through the internet. Understanding Of Key TerminologiesReact: It is the JavaSc
4 min read
What is Cloudflare | How it Works and When do you use it?
Online presence has become important for all businesses, organizations, and individuals, ensuring websites and applications are fast, secure, and reliable. Now if you are thinking what is Cloudflare com and what is Cloudflare used for- Cloudflare is a widely used content delivery network (CDN) and i
8 min read
How to Use Azure Front Door to Distribute Your Content
In today's world, where delivery of content material needs to be quick and efficient to users across the globe. Azure Front Door, a robust and scalable content delivery network (CDN) service provided by Microsoft Azure, empowers organizations to achieve. By strategically distributing content and app
7 min read
How to deploy PHP apps into Cloud ?
PHP is a server-side scripting language that can be used for developing web applications or websites. In this article, we will see how to deploy the PHP applications in the Cloud. To deploy PHP apps on the cloud, we can use any cloud service provider. Here, we will be using the AWS EC2 Instance base
3 min read