Cloud SQL - GCP - Lab



 CLOUD SQL LAB

Google Cloud Platform



Cloud SQL is a service for fully-managed and reliable M S SQL Server, My SQL and PostgreSQL databases. It is a  Regional / Multi-regional / Global service compares to Amazon's relational database service (RDS). It supports automatic replication, backup, and failover and if you need to scale a cloud SQL instance you have to do that manually or switch to Cloud spanner





Step 1.  Build a SQL instance (MS SQL Server)

  • Go to Google Cloud Dashboard
  • In all products go to Databases then go to SQL  (Earlier Cloud SQL)


Google Database Services



  • Click Create Instance to provide all configurations you are looking in SQL managed Instance
  • Managed instances are where you are not woried about Operating system and Infrastructure configuration.
  • You also don't need to spent time on setting infra for  High Availability,  Backups, Maintenance.




  • You will see 3 options
    • SQL Server
    • MY SQL
    • PostgreSQL
  • You can pick one of software solution as per your business requirement
  • In managed services, the benefit is you don't need to be aware of Installation or internals of database software's
Pick manage instances in Google cloud database SQL


  • Please provide Instance name in small letters
  • provide password for sysadmin / Instance owner , In my case its M S SQL server so user name is "sqlserver" , if you are using this for production make sure password is strong
  • Select database Version (Its the version of SQL services you want to use). In my case I picked the SQL Server 2019 Enterprise edition.
  • If You are doing this activity for learning you can use, web or express edition
  • In my case i have pick production environment, If you are doing for learning purpose, please choose development or sandbox

SQL instance, environment, password

  • I am using default region, though I should prefer nearest and cheapest region
  • For practice purpose you can choose single zone, I am using multiple zone to try high availability.
  • High Availability will make sure that if there is any down time in one zone automatically secondary zone will start acting as primary and user will not face down time


Google Cloud SQL and High Availability

  • Select machine type, will change CPU and memory configuration. please select as per business approval as this will define cost
  • In storage I am using only 50GB SSD, you can keep custom with auto increment.
  • Connection should be public, so I can test whether my SQL instance is working or Not


Network connectivity, Public IP




  • In data protection, You can enable following options
    • Automated backups, You can just set schedule and system will take care of backups
    • You can enable point in time recovery for critical databases
    • Make sure to uncheck "Enable Deletion protection" if you are creating database server for practice. In production this should be enable.


Google dataprotection

  • You can set schedule for maintenance, yes you don't have to worry about database maintenance
  • You can setup collation or other required flags
  • Label should be setup in case of having multiple database instances.
  • This is Final Step in creation of SQL instance





  • Now SQL Instance is created
  • You can check in SQL instance dashboard



SQL instance dashboard

Step 2: Connect Google Cloud SQL with SSMS


  • If you want to connect cloud SQL with SSMS, You have to setup Authorized networks either during Setup of SQL or later.
  • I will go in SQL instance properties
  • Go to Connections, In connections go to networking, Scroll down and look for Authorized networks
  • In Authorized networks, add your network by cicking buttone  "Add a network'
  • If you don't know your IP use "https://whatismyipaddress.com/'



Connect Google cloud Sql with SSMS

  • If you go to "https://whatismyipaddress.com/', it will show your current IP address
  • Feed your IP address in Google cloud to allow connections from tis network only




  • Lets check Public IP of SQL server instance from Google cloud SQL dashboard
  • we will input same in SSMS

cloud SQL SSMS


  • Open SSMS
    • Use Instance Public IP in servername
    • Authentication should be SQL server Authentication
    • Login: we are using default login "sqlserver"
    • Password; we have setup password during creation. You can add more user or change password if required from google cloud dashboard




Now We are connected with SQL server on Google cloud managed services using SSMS


Now We are connected with SQL server on Google cloud managed services using SSMS



  • Once all work is done don't forget to delete the instance by clicking delete button.
  • If you are not able to delete the instance , means you have check delete protection. please uncheck and retry






No comments:
Write comments

Please do not enter spam links

Meet US

Services

More Services