Creating Pub/sub topic on Cloud from CLI | Google Cloud Qwiklabs

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello everyone welcome back to my channel my name is somya in today's video I'll be doing this lab Google Cloud bubbles up using a command line interface so in my previous lab I completed this Cloud purpose subtopic on a web console today I will be performing this lab so it's a seam lab but we will be using command line interface so let's click on this lab you can click on start lab so I've started this lab now and I also logged into the Google Cloud console using the student ID and password so as part of this lab we'll be creating a purpose of topic and this lab will learn the basics of Pub Sun we'll create delete and list pop sub topics we'll publish messages to topic and we'll see how to use a full subscriber to operate individual topic messages we will also see how to use a full subscriber to pull all messages from the subscription so let's proceed with a task one Pub sub topics so perhaps up.com separate installed in Google Cloud shell so we don't have to install or configure anything we just start the service so let's create first topic by executing this command gcloud pops up topics and we'll be creating a topic by the name my topic so let's copy this so let's activate our Cloud shell layer so let's open this in a new window so let's copy paste the now the pops up topic is created so let's come back and click on check my progress and they should be complete now so now you can see it's complete so let's create two more topics by the name test one and test two let's copy this command let's go back to Cloud Channel and execute this command so this will create one more topic by the name test one so let's copy this command as well and execute it here if you want to view the topics which you have created we can use this command to list those topics so let's copy this command let's go back to Cloud shell and execute it here so it will list all the topics which got created recently so here you can see all the topics you can say the name of the topic this is the name of the topic so it will show all the topics now let's proceed with this so let's delete this topics so by executing this command it will delete the topic so here we are passing delete command to delete this topic so let's copy this command and delete the two topics so now we are deleting this topic test one it's related now let's go back let's copy this command and delete the test two topic as well now let's go back so let's execute this command again gcloud pops up topic list and see uh how many topics get listed now now you see only one topic by the name my topic so let's clear this screen so let's proceed with attach to pop sub subscription so we will create a subscription to our topic so we need to execute this command gcloud pops up followed by the subscription and we are creating a subscription to this topic so we need to ensure that we pass this hyphen hyphen topic and the topic name and the subscription name so let's copy this command let's go back to Cloud chill execute this command so now the subscription got created for this topic let's go back and you can click on check my progress and they should be complete now so let's add another two subscription to the topic so let's um execute this command so we will be adding subscription to this topic test one and test two so let's copy this command go back to Cloud Channel execute it here so this will create another subscription so now it's created let's go back let's copy this command as well and execute it here it's done let's go back so let's run the following commands to list the subscription to topic so we will execute this command gcloud pops up topics list hyphen subscriptions and followed by the topic name so remember that we have added subscription to the topic my topic so we are listing the subscription which is made to this topic by executing this comment so let's go to this command go back to Cloud shell and execute it here see now you can see there are three subscriptions you should get this output to receive messages published to a topic you must create a subscription to the topic yes that's true now delete the test one and test your subscription so let's execute this command totally to subscription it's related let's copy this command it's related so let's proceed so again we'll list the subscription to the topic by executing this command so now we choose there is only one subscription let's proceed with the task 3 pops up publishing and pulling a single message so let's uh execute this command to publish the message hello to the topic my topic since we are publishing a message we need to ensure that we pass this publish command and topic name here and the message hyphen hyphen message hello so let's copy this command let's execute it here so you should get this output let's publish few more messages so let's copy this command here you need to ensure that you replace this name let's copy this so so we are just publishing a few messages to our topic next we will use the pull command to get the messages from the topic the pull command is subscription based let's execute this command quick load pop subscription followed by the pull since we are pulling the messages from this subscription so whatever messages we have published we are pulling those messages so let's copy this command go back to Cloud shell and execute it here and we shall get this response so we shall get this output we got the same output now let's proceed with a task for pops up pulling all messages from subscription so if you want to pull all the messages from the subscription we need to execute this command jcloud pops up topics publish my topic iPhone message so here we will be publishing few messages using this command so let's copy this command it's executed here so we are publishing few messages to the subscription once that is done we'll add a flag to the command to see output of all three messages in one request in the previous command we use this iPhone iPhone Auto iPhone hack so when we use this this will format the messages into a proper format we can set few formats so here you can also we can also set this limit flag using the limit flag we can set a limit on the number of messages to the pull so here we need to pass this command gcloud Pub sub subscription pull so we are pulling the messages and we are setting the limit to 3 or to iPhone hack so this to get this message in this proper format we are passing this command so you can see how neatly it is given the output so let's copy this command and execute it here so you shall get this output so now we have completed this lab so in this lab we saw how to create a pub sub topic using a command line interface how to create a subscription and publish the messages to this topic and click on end lab and then this lab I hope you found this video helpful please like And subscribe to my channel and stay up to date with the latest content on this channel thank you all for watching see you in the next video
Info
Channel: techgalary
Views: 204
Rating: undefined out of 5
Keywords: cloud, learn technology, google gcp, google cloud, qwiklabs, google cloud lab, gcp handson
Id: 8h891_FsCuo
Channel Id: undefined
Length: 8min 5sec (485 seconds)
Published: Sat Sep 16 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.