PRIYANKA VERGADIA: Welcome back to "Get Cooking
in Cloud," where we share the best recipes
to apply in your cloud kitchen.
I'm Priyanka, and today is our final day
in our gluten-free kitchen with our special guest, Jenny.
JENNY BROWN: That's right.
We've been through so much on this journey,
from realizing it was more than just a recipe
to making sure allergens and personally identifiable
information stay where they belong.
So let's jump back in.
[MUSIC PLAYING]
PRIYANKA VERGADIA: In the last two episodes,
we've talked about Dinner Winner, which
is an application that collects recipes from users
all over the world, and the winning recipe
makes it on their platform and receives an award.
We know there might be personal information initially tied
to these submissions that need to be removed before anything
else can happen.
And we want this to be a seamless automated process.
We saw an architecture of how they can automate and classify
the uploaded data by using Cloud Storage, Cloud Functions, DLP,
and pub/sub.
JENNY BROWN: We created a four-step process
for the Dinner Winner team to get this solution implemented.
And we were halfway there by setting up
our project and our permissions and creating the Google Cloud
Storage bucket and pub/sub.
PRIYANKA VERGADIA: Today, we combine the remaining
ingredients and bake.
JENNY BROWN: When making something gluten-free,
we need to check on two things--
our ingredients are gluten-free and our environment
is gluten-free.
PRIYANKA VERGADIA: Similarly for Dinner Winner,
we need two Cloud Functions-- one
that is invoked when an object is uploaded to Google Cloud
Storage and the other that is invoked
when a message is received in the Cloud pub/sub queue.
Let's start by creating the Cloud Function that triggers
from the Cloud Storage bucket.
We will open Cloud Functions and create a new function.
Name it as Create_DLP_job.
In the trigger field, we will select Cloud Storage
and select the quarantine bucket from the bucket browser.
Select Python 3.7 for the runtime.
And in the inline editor, copy and paste
the code from the link in the description
below in main.py and requirements.txt.
You will find that there is a Create_DLP_job function, which
creates the DLP job from when a recipe is
uploaded in the bucket.
So in the function to execute, we
will replace the hello_GCS with Create_DLP_job
and create that function.
JENNY BROWN: Now, we need to create the Cloud Function that
gets invoked when a message is received in the Cloud pub/sub
queue.
It's pretty much the same, but this time, we'll
choose Cloud pub/sub in the trigger field
and enter our pub/sub topic.
We will use the same function code as last time,
but in the function to execute, we use resolve_DLP this time.
And with that, we have both our Cloud Functions ready.
And now for the moment of truth.
Has our recipe for secure application automation
done the trick for Dinner Winner?
PRIYANKA VERGADIA: I think we've effectively
avoided any personal information cross-contamination,
but we will need to test it out and make sure.
JENNY BROWN: So we've got some sample recipes that
have some sensitive data in them and some
that have non-sensitive data.
PRIYANKA VERGADIA: We are defining the sensitive data
as name, email address, location, and phone numbers,
but you can change it in the code
to define it values or info types that you prefer.
JENNY BROWN: OK, so let's test it.
PRIYANKA VERGADIA: We will do it in Cloud Shell.
Clone the git repo, navigate to the sample data,
and then copy the files over to GCS quarantine bucket.
The DLP API inspects and classifies
each file uploaded to the quarantine bucket
and moves it to the appropriate target bucket based
on its classification.
JENNY BROWN: Let's open our buckets
and review the uploaded files.
Let's click on the quarantine bucket and click on a file
and see that it does not have any sensitive data.
Let's also check out one of the files
from the non-sensitive bucket.
And we see that it does not contain any sensitive data
either.
Now, one final check.
Let's see one of the files in our sensitive bucket.
And as expected, this contains emails,
which is one of our sensitive data parameters
that we had set.
PRIYANKA VERGADIA: So that's it.
Dinner Winner has their application automated
and can return to their gamified recipe submission
with confidence.
JENNY BROWN: Here's to the pursuit of deliciousness.
Check out the article linked in the description for more
step-by-step information.
PRIYANKA VERGADIA: If you're hungry for more,
be sure to like, subscribe, and catch us next time
for another episode of "Get Cooking in Cloud."