SQLServerCentral Article

Getting Started with SQL Server on Google Cloud Platform


There are a number of providers for SQL Server in the cloud. Having multiple options brings along the complexity of having to decide which option works best for you. This means you get to play, test, and maybe even have a proof of concept with different providers. It is usually not a big deal to get access to cloud platforms through work, but what if you do not have that choice or just want to play around with it at home?

Luckily, SQL Server on Google Cloud Platform gives you that option. They offer a free trial of their platform for 12 months or until you use $300 worth of resources. This article will walk you through getting started with the free trial.

Starting the trial

First things first, navigate to https://cloud.google.com/sql-server/.  Once there, click on the FREE TRIAL button.

If you are not already logged into Google, you will be promoted to log in or create an account. Otherwise, you will be taken to Step 1.

For Step 1, select your country, read all of the terms and conditions (because I know you will), click the "I agree" checkbox, and then click the CONTINUE button.

Now step 2 is a bit scary. Google requires you to enter a credit card. There is a note next to the form which mentions that this is to verify you are not a robot and you will not be charged unless you manually upgrade your account. If you already have a credit card on file with Google then you are good to go. Otherwise, enter a credit card to continue. If you choose to not enter a credit card, then I'm afraid your journey ends here, but feel free to read on.

Once you click the START TRIAL button and give it a few seconds to process, you should be greeted with a welcome screen. Click on GOT IT once you finish reading the popup.

Creating your first instance

Here is where I was confused for a few seconds. After you clear the welcome screen, you will see an option to create a MySQL or PostgreSQL instance. I thought this was for SQL Server? It still is, but you have to perform a few more actions before we have that instance running.

We do not want to do that so you can ignore this step (unless you want to try that). Instead, we are going to use Google's console, called Cloud Shell. You can navigate through the different menus to do this, but I am a CLI type of person so that is what we will do.

If you really want to use the web page to create the instance, I recommend looking at this tutorial first https://codelabs.developers.google.com/codelabs/cloud-create-sql-server/. To open the console, click "Activate Cloud Shell" button in the top right corner. This will open the console at the bottom.

Now we will run the command to create the SQL Server VM instance. To do that, run the following command replacing the parameters with whatever meets your needs.

gcloud compute instances create blakesqlinstance     --image-project windows-sql-cloud     --image-family sql-exp-2017-win-2016     --machine-type n1-standard-2     --boot-disk-size 50     --boot-disk-type pd-ssd

You can change the name BlakeSQLInstance to whatever you want the name of your SQL instance to be. Image-Family can be changed to another image that Google supports (https://cloud.google.com/compute/docs/images#os-compute-support). Machine-Type set the vCPUs, memory, max persisted disks, and max disk size. This can be set to any of the options found here https://cloud.google.com/compute/docs/machine-types. Finally, boot-disk-size is the size of the disk in GB and boot-disk-type is the type of disk. You can find other options, as well as much more details about creating a SQL Server instance here https://cloud.google.com/compute/docs/instances/sql-server/creating-sql-server-instances.

Once you have made your changes to the command, paste it into the console and press enter. If you are asked to select a zone or enable the API, enter Y.

After a few minutes, you should see a message with the instance's information.

Now you'll want to open port 1433. Run the following command to add a rule to the firewall for SQL Server. Make sure you specify the network name if you changed it.

gcloud compute firewall-rules create sql-server-1433 --description "sql server firewall 1433" --allow tcp:1433 --network default

Creating an account to connect

You may think you can use your Google account to log into the instance, but you would be wrong (just like I was). The next step is to create an account. Run the following command in the Cloud Shell to create a random user name and password. Make sure you replace "blakesqlinstance" with the name you created above.

gcloud compute reset-windows-password blakesqlinstance

This command will take the default and reset that password. You can also specify the user. More information can be found here https://cloud.google.com/compute/docs/instances/windows/creating-passwords-for-windows-instances. After a few seconds, you will receive a new password.

Connecting to the new instance

I must admit, it was right here when I started to run into issues. I was able to get past them, but it did cause some headache. There are probably ways to avoid this in the future before you get to this point but for now we will do it the hard way.

The first thing I tried was to connect to the server using SSMS on my home computer but that did not work. What you can do is RDP into the instance using the external IP address and the user name and password created earlier. Once connected, I used SQLCMD to create a new login and tried to connect with my local SSMS, but it still failed.

Eventually, I gave up on SQLCMD and installed SSMS on the instance (it comes pre-installed if you use SQL Server 2012 or 2014). Once installed I noticed 2 issues. The new login had the default language set to Arabic. That may not have been causing issues but I changed it to us-english anyway. The next issue (and the last one causing me issues to connect remotely) was the server authentication was set to Windows only. Changing that to mixed authentication mode allowed me to connect to the instance from my home computer.

Final Thoughts

Now that we have a instance created and can connect to it remotely, it is time to have fun and push it until it breaks (or you run out of the free money or 12 month limit). On the surface, it's nothing too exciting since it is a SQL Server instance running on Windows Server which is nothing new. The exciting part comes with learning what Google Cloud Platform can do for you or your organization.

There are a number of options to consider when looking at hosting in the cloud. Much of it comes down to what you can get for how much money. I always recommend looking at all of the options, talking to friends and colleagues knowledgeable in the subject, and researching as much as possible before deciding on anything.


4.25 (4)

You rated this post out of 5. Change rating




4.25 (4)

You rated this post out of 5. Change rating