Join Joseph Lowery for an in-depth discussion in this video Managing instances, part of Google Cloud Storage and Data Essential Training.
- As noted in the in intro to Cloud SQL, you can easily create and manage database instances. We'll walk through all the necessary steps in this lesson. Like several other of the Google Cloud Platform components, Cloud SQL is automatically activated. So from the Google Cloud console for my project, let's use the navigation on the left to go to Storage, Cloud SQL. Eventually, this screen will display any Cloud SQL instances, so let's go ahead and get one going.
I'l click Create an Instance, and first of course is to give our database instance a name. Again, it has to be unique. I notice that the project ID is part of it; that helps with its uniqueness. So I'm going to go ahead and enter lynda-db-001. Next, I could choose which region I want to host my database in, and you can see there are three different regions. I'll go ahead and stick with the United States, as that is closest to my target audience.
Then, I could choose my tier from any of the available options here. I'm going to only be doing some minor testing, so let's go with D0, the lowest here which allows for 128 MB of RAM. Now, you could stop there and create the instance, but let's look at the advanced options first, and there are quite a few of them. So go up and click on Show advanced options... Now, after specifying the region and the tier, we see that the database version is next, and as I mentioned in the intro, you have to start with MySQL 5.5, and you do have an option for going to 5.6, now in preview.
So let's stick with 5.5, as my app doesn't need 5.6 capabilities. So now, for the billing plan, I can choose either Per Use or Package. The least expensive way to go, especially for the testing I'm going to be doing, is Per Use. So I'll stick with that. Now, although we've set the region, we can get more specific with our database location. It can follow the VM instances from App Engine, Compute Engine, or we can specify no preference.
Let's follow the App Engine App. And you can specify which project that you want to follow as well by changing the ID in this field here. Now we only have one project set up, so there's only one listed. The next section deals with backups, and I'm a big believer in backing up your data, especially dynamic data, but we are going to cover this feature in detail later in the chapter, so I'm actually going to go ahead and deselect Enable backups. Don't copy this implementation; make sure that you follow through on seeing the backup lesson later in the chapter.
Let's scroll down a bit more. The ACTIVATION POLICY section that you see here determines when your database instance comes to life. If you've chosen a Per Use billing plan, as we have, going with On Demand, which activates the instance only when requested, makes the most sense. If you were on the Package plan, you could always leave it up and choose the Always On option. Next is FILE SYSTEM REPLICATION. That's another database-related feature that we'll cover in a later lesson.
Now if you rely on the earlier Internet protocol, IPv4, you can select this next option that you see here, however, as it notes, there is an additional charge, and most apps are fine with the current IPv6 protocol. Of course, your mileage may vary. Speaking of protocols and networks, you can even designate one or more authorized networks by specifying their Classless Inter-Domain Routing, or CIDR address.
Next, we can pick which App Engine applications we want to work with. That's not the focus of this particular course, but it's a common workflow with Google Cloud Platform. And, since we only have the one option, let's leave it where it sits. And finally, a full range of MySQL flags are available. Let's scroll down a little bit, so you can see as many as possible, and the flags start with character_set_server, and go all the way down to wait_timeout. Now you can choose as many flags as you like.
Some, like event_scheduler, I'll go ahead and select that, are simple on-off switches, while others, such as log_output, have specific options. Now I'm going to go ahead and clear those flags for now. I just wanted to show you what was available there. All right; let's click Save. And pretty quickly, our Cloud SQL instance is up and running. Now once it's created, I'll be able to click on its name and see a few more details about it.
And let me close the activities monitor, and click on my database instance. Now, of course we just created this, so there are no details to be displayed, but you can see where the chart would go. Now if you go to the OPERATIONS tab, you can see that it was created, and if you ever need to modify the instances, you can click on Edit. This will allow me to change my tier if I ever need some more database power. So I can go in and up it, if I needed to.
Other options include changing the billing plan, backup options, App Engine connections, and others. Let's scroll down just til we hit the Cancel button, and back out of that. So I don't need to make any changes at this time. Now adjacent to the Edit button up top here, are Import and Export controls. We're going to discuss those in the next lesson. And next to them is the Restart button. Occasionally, you may come across a need to reset some configuration on your database instance that will require a restart.
It's a one-click option here in Cloud SQL console, so let's give it a shot. It asks for confirmation, I click OK, and you can see by the status shown there that it's restarting, and now we're back to running. Great. Then, there is the Delete button for deleting your database instance. Of course, you want to be very careful before you delete an instance. Not only will it wipe out any data that you've stored on the database, but it also prevents you from using the same instance name for two months.
So be sure before you delete. The final button, Create read replica, is another backup feature, which, again, will be covered later. Now, that's all on the Overview tab. You can also keep track of your Cloud SQL instance activity by choosing OPERATIONS. And modify your access under the ACCESS CONTROL. Here, you can establish a direct IP address, set a password, define authorized networks and applications, and manage SSL certificates. Cloud SQL is really completely configurable, all from the online GUI.
And that completes our tour of Cloud SQL instance management. In the next lesson, I'll show you how to import and export your data.
- Installing the Google Cloud SDK
- Working with buckets and objects
- Building a website with Cloud Storage
- Using Cloud SQL to manage data
- Setting up Cloud Datastore
- Exploring data with BigQuery
- Managing storage and data with Python