Cloud Run + Cloud SQL, setup

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ก.ค. 2024
  • Code for this episode → goo.gle/3eSifpa
    Cloud SQL documentation → goo.gle/3eSifpa
    Cloud Run documentation → goo.gle/3cMPsj3
    Cloud Run is serverless, which means you don’t have to worry too much about configuration settings. If your code connects to a relational database, you will find that Cloud SQL is not serverless and that it has a lot of configuration settings. But don’t worry, in this video Craig and Martin will set up and configure a Cloud SQL machine and show how to connect to it from Cloud Run code!
    Timestamps:
    0:00​ - Intro
    1:37 - Why Cloud SQL
    2:22 - Creating and configuring a new Cloud SQL instance
    6:33 - Creating and populating tables
    7:10 - Connecting to Cloud SQL from Cloud Run code
    9:20 - Deploying the application to Cloud Run
    Checkout more episodes of Serverless Expeditions → goo.gle/ServerlessExpeditions
    Subscribe to Google Cloud Tech → goo.gle/GoogleCloudTech
    #ServerlessExpeditions​ #CloudRun
    Product: Cloud Run, Cloud SQL; fullname: Martin Omander, Craig Labenz;
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 37

  • @googlecloudtech
    @googlecloudtech  3 ปีที่แล้ว +3

    Get $300 and start running workloads for free → goo.gle/30Zg36Y

  • @brainscott
    @brainscott 3 ปีที่แล้ว +13

    Love these Martin, enjoy the different guest per episode. Would be great to see an episode on Cloud Run + Secrets Manager

    • @MartinOmander
      @MartinOmander 3 ปีที่แล้ว +1

      That's a great idea, Brian. Thank you!

    • @TheMomander
      @TheMomander 2 ปีที่แล้ว

      We now have video for integrating Cloud Run and Secret Manager: th-cam.com/video/JIE89dneaGo/w-d-xo.html. Thank you suggesting this topic!

  • @sunnyj9088
    @sunnyj9088 2 ปีที่แล้ว +3

    You guys rock. I'm either voting for tabs or space, however I'm sure voting for more videos like this 🙂

    • @TheMomander
      @TheMomander ปีที่แล้ว

      Thanks, Sunny, much appreciated!

  • @samueldavidpolopena5663
    @samueldavidpolopena5663 2 ปีที่แล้ว

    Thanks a lot for the great video! I have a little question and a remark, for the question, how would the code change if I'm using a MySQL Database? I mean, for the sqlalchemy drivername part. And the remark is that, in the description, the link is repeated for "Code for this episode" and "Cloud SQL documentation" 😅

  • @johnrodkey4329
    @johnrodkey4329 3 ปีที่แล้ว +5

    Would love to see this using Firestore and the extension to sync data to bigquery then using the new materialized views for dashboard / reports.

    • @DefBroadcasting
      @DefBroadcasting 3 ปีที่แล้ว +2

      Yeah bigquery, especially with new materialized views, came to mind when they described the use case to me as well.

  • @Jkevingutierrez
    @Jkevingutierrez 2 ปีที่แล้ว +1

    Would be great to see the private IP configuration

  • @samanthaletourneau9709
    @samanthaletourneau9709 2 ปีที่แล้ว +1

    what about C# connection string ?

  • @krishnakantchaurasia269
    @krishnakantchaurasia269 2 ปีที่แล้ว

    small question about the database connection name, i can see that it has define in 3 places (.env, code as a query, cloud deply cmd).
    defining connection in one place would not be enough ?

    • @johnpankowicz4823
      @johnpankowicz4823 2 ปีที่แล้ว

      I think what you are seeing is that the same connection name needs to be defined both within the Cloud Run instance and within the CloudSQL instance. The shell script is executed on the Cloud Run instance. Also, in the CloudSQL instance, it is not defined in the code query. The query get its value from the environment, because it is defined in .env.

  • @mayanksharma6967
    @mayanksharma6967 2 ปีที่แล้ว

    Please add video with nodejs code too for postgresql to connect and query :) .. thanks!!

  • @Euquila
    @Euquila 3 ปีที่แล้ว

    Gosh, y'all so smart

  • @rara737
    @rara737 2 ปีที่แล้ว +5

    Do not follow the tutorial in this video. I was following this video as a practice and paid a lot of money. I didn't know this was going to cost money (thought it would not be charged for a very small test scale) I connected to gcp phone,email support but They always just told me to delete the project (How do I delete a service that is already running with Firestore?) Maybe it was because the support team didn't know anything about development. I finally found a way to disable cloud sql on the gcp console api resource side all by myself. And finally I was able to stop charging. Beginners can get lost, so be careful. If you don't have supporters to help you

  • @BM-dl9tb
    @BM-dl9tb 9 หลายเดือนก่อน +1

    Hi, im currently working on a project but i dont know really well how to use google cloud shell, so my question is: How do you create and populate tables with a mysql DB? I hope you can help me thanks.

    • @MartinOmander
      @MartinOmander 9 หลายเดือนก่อน +1

      In your Cloud SQL instance page, click IMPORT. From there you can browse to a file that you have previously uploaded to Cloud Storage. The file can be a CSV file or an SQL dump file that you have exported from another database.

    • @BM-dl9tb
      @BM-dl9tb 9 หลายเดือนก่อน

      @@MartinOmander okay 👍🏻, thank you.

  • @gogl92
    @gogl92 3 ปีที่แล้ว +4

    What happens if my SQL server is in a different project?

    • @craiglabenz9147
      @craiglabenz9147 3 ปีที่แล้ว +3

      Private IPs (aka, VPCs) require a little bit of extra configuration that is documented here: cloud.google.com/sql/docs/mysql/private-ip; and if you're connecting via the Cloud SQL Proxy, then you have to enable the Admin API in the project that hosts the Service Account you're using to connect.

  • @EduardoHernandez-xz8dr
    @EduardoHernandez-xz8dr 2 ปีที่แล้ว

    Could you point us to the load testing part video? Thanks a lot!

    • @TheMomander
      @TheMomander 2 ปีที่แล้ว +1

      The load testing video is here: th-cam.com/video/r9qvB-JH4jM/w-d-xo.html

  • @winstonkwan
    @winstonkwan ปีที่แล้ว

    I tried this with a cloud run but I cant connect to the CloudSQL MySQL server unless I allow 0.0.0.0/0. Is there another solution to this with Cloud Run and CloudSQL on public IP?

    • @craiglabenz9147
      @craiglabenz9147 ปีที่แล้ว +1

      In general, I recommend avoiding IP addresses and instead adding the correct Cloud SQL instance as an official connection in the Connections tab on your Cloud Run instance (under Deploy a new Revision), and then from within code, connecting via the running Cloud SQL Connector that Cloud Run supplies.
      You've tried this and it didn't work? If so, what error are you getting?

  • @daftzero9767
    @daftzero9767 3 ปีที่แล้ว +1

    why not use vpc serverless connector and private vpc to reach de cloud sql instance?

    • @laybunzz
      @laybunzz 3 ปีที่แล้ว

      If you're familiar with these concepts and know you need or want them, then by all means, they are a great idea. I was merely meaning to imply that for many new projects, it's better to focus on the basics and get something launched.

    • @mkc11267
      @mkc11267 2 หลายเดือนก่อน

      saw vpc servless connector today after 3 years. It costs a lot of money

    • @TheMomander
      @TheMomander 2 หลายเดือนก่อน

      @@mkc11267 Cloud Run can now send data directly to a VPC, so VPC Serverless connectors are no longer needed. This reduces the cloud bill and the project complexity. Check out my video "Cloud Run to VPC, simplified" for the details!

  • @dita0322
    @dita0322 3 ปีที่แล้ว

    What happen with the old serverless videos where you use nodejs as an example?

    • @KevinBoutin
      @KevinBoutin 3 ปีที่แล้ว +1

      Nothing wrong with changing it up. We have code examples for both now. :)

    • @megairrational
      @megairrational 3 ปีที่แล้ว

      @@KevinBoutin where could we find them?

    • @KevinBoutin
      @KevinBoutin 3 ปีที่แล้ว +1

      @@megairrational on this youtube channel.

  • @brainscott
    @brainscott 3 ปีที่แล้ว

    If you don't want to deal with a Build & Deploy script, you can use a single command "gcloud beta run deploy --source=[DIRECTORY]" - cloud.google.com/blog/products/serverless/build-and-deploy-an-app-to-cloud-run-with-a-single-command

    • @TheMomander
      @TheMomander 2 ปีที่แล้ว

      Thank you for adding this, Brian!

  • @kalidsherefuddin
    @kalidsherefuddin 3 ปีที่แล้ว

    Please please help me

  • @czechmate1124
    @czechmate1124 2 หลายเดือนก่อน

    Something very creepy about the dialogue here. The curated responses are ...not human like.