Experimenting with GCP Cloud Functions
--
I’m taking Information Security and Privacy for my graduate program right now, and the topic has diverted this week to containerization and serverless architecture. I’ve decided to document getting a function set up on GCP (Google Cloud Platform) because I haven’t really dabbled with any function-based platforms yet. My knowledge on serverless is pretty much “it’s a function in the cloud” which doesn’t say much, so I’m hoping to grasp a little more what the implementation looks like with this.
I’m choosing GCP (over AWS or Azure) because I like their documentation and console. I’ve chosen to build a function that will deliver a Game of Thrones winner because — well, why not?
Setup
It’s pretty easy to set up. Just go to Google’s GCP page and click “Cloud Function” from the sidebar. There may be a few extra steps if you’re a new GCP user. In order to create a Cloud Function, you just have to opt into the free trial, which gives users $300 for a year (at least, I think that’s what I read) and you do need to input a credit card for when the $300 is used up.
Creating a function
This is so much easier than I thought it would be. I clicked a button, and a form has been rendered for me to create my function. There’s even a text box to write my code. I can choose between JavaScript (with different Node engines), Python (3) and Go (1.11). While I want to practice my Go, I think I’ll opt for JS because I can write it about 100x faster.
I’m starting to think this is a blog post about how easy it is to create a function on GCP, but I want to keep in mind that having 100s or even 1000s of these could get incredibly complex very quickly.
I wrote my program and was able to “deploy” it (in this case, that would mean uploading it). I used pictures from Fandom because I didn’t want to make any outgoing requests that would cause latency and complexity.