[MUSIC PLAYING]
VIDYA NAGARAJAN: Hi, everyone.
I'm Vidya Nagarajan, and I'm the Product Lead for Serverless
on Google Cloud Platform.
Thank you for having me here today.
I'm going to talk about serverless products,
particularly Cloud Functions and Eventarc, for startups.
This is a Lightning Talk, so I will move quickly.
As an early-stage company, your most precious resource is time.
You probably need to focus your development efforts on where
you are most differentiated.
You need to get to market fast.
The term "data-driven organization"
should sound very familiar.
For years, harnessing the power of data
has been key to the success of organizations
and is, of course, the new way forward.
However, the nature of what it means to be data-driven
is changing because the nature of business is changing
and user expectations are changing.
In today's fast-paced landscape, you
need to react to data in time.
Users expect action right away using
timely, up-to-date, real-time data and insights.
But, that being said, I'm going to edit the previous statement
to say--
I want to create an event-driven organization.
Building applications and systems
that react immediately to changes in your environment
or application provides the real-time insights
that users expect and that organizations depend on.
With the above context, Cloud Functions
is one of our serverless compute offerings
where you can develop quickly and securely
by writing and running small code snippets that
respond to events.
You get pay-per-use, auto scaling--
and, in return, Google manages your infrastructure
so that you can focus on your core business, which most
likely isn't managing servers.
Cloud Functions is the glue connecting cloud services.
On the left side, you can see various events
that happen in the world.
And, on the right side, you can see
the services you can call into.
Cloud Functions isn't just about connecting GCP services.
You can post to a function endpoint
from basically anywhere and respond
by calling another endpoint outside Google Cloud.
And the events are orchestrated by Google's serverless product,
Eventarc.
Serverless computing can be leveraged to build
powerful things.
These include, but are not limited to asynchronous
large data processing pipelines.
For example, a roadside camera captures
images that are processed to extract the license plate
number.
Analytics.
Example-- you can run near-real-time analysis
on files that are added to cloud storage
by streaming data from cloud storage
into BigQuery using Cloud Functions.
Microservices orchestration to build
modern, event-driven applications
to go to market quickly.
Business process automation by managed execution
of business processes.
For example, a field technician uploads a code
for a job using a mobile device, which triggers
warehouse inventory checks.
And, lastly, cloud ops automation.
By programmatically provisioning, modifying,
and deleting cloud resources, many of these operations
can be event driven.
So now let's take a look at what's new.
Cloud Functions the second generation
is in public preview.
I'm excited about some of the key benefits
around infrastructure enabled that include longer request
processing.
You can now run your Cloud Functions
longer than the five-minute default that was possible,
up to 60 minutes, making it easier
to run longer request workloads, such as processing
large streams of data from GCS or BigQuery.
Larger instances leverage up to 16 gigabytes of RAM,
or 4 VCPUs, on Cloud Functions, allowing
in-memory, compute-intensive, and more parallel workloads.
Concurrency-- you can leverage up to 1,000 concurrent requests
with a single function, minimizing cold starts
and improving latency when scaling.
Minimum instances-- you can now provide
for pre-warmed instances to cut your cold starts
and make sure the bootstrap time of your application
does not impact the application performance.
Traffic splitting-- you can now support multiple versions
of your functions, split the traffic
between different versions, and roll your function back
to a prior version.
Secrets Manager-- native integration
with Cloud Secrets Manager is now
available to get access to your secrets.
You can additionally enjoy a broader event coverage
and industry-standard support for cloud events
for a consistent development experience
with the Eventarc integration.
Eventarc brings over 90-plus sources using cloud audit logs.
And, of course, Cloud Functions still
supports events from your custom sources
by publishing to Cloud PubSub directly.
Additionally, Eventarc comes with a new, simple UI
in the Cloud Console.
Now let's go through a quick demo.
The demo will walk you through a cloud function that
performs lightweight ETL on a customer's checkout
operation via Stripe and update a dashboard
on Google Sheets for your team's business analyst.
And you can use Google Cloud Secrets Manager
to securely store your secrets, such as your Stripe API
key and your endpoint secret.
In this demo, Rob is the business analyst
of a merchandising company selling
different types of products-- has access to a revenue
dashboard that tracks sales revenue and costs over time.
The company has recently expanded sales
from the west coast of the United States
to the rest of the country.
He is looking to spot trends, activities,
and gather actionable insights in real time.
Let's look at the building blocks for this operation.
First, let's create a cloud function
from the Google Console.
We'll call our function processStripeCheckout.
Although we're using an unauthenticated function,
you'll see later how we can still
verify that Stripe initiated the request.
Minimum instances is a new feature that can dramatically
improve the performance of your application,
minimizing your cold starts.
By specifying a minimum number of instances
of your application to keep online
during periods of low demand, you
can eliminate startup latency.
For this demo, let's keep one instance warm.
We'll use a runtime environment variable for the Google Sheets
ID so that we don't have to hard-code it
in our source code.
We'll also use Secrets Manager for storing secrets.
We have two secrets for this demo, the Stripe API
key and the webhook secret.
We're going to choose Latest for the webhook secret.
This means that, once we get the secret from Stripe,
we can update it in Secrets Manager
without having to redeploy our function.
Next, you can specify the runtime.
For this demo, we'll use Node.js 14.
And let's update the entry point with the name of the event
handler that will execute whenever this cloud function is
invoked.
These first few lines are where we'll pull in the Stripe keys
from Secrets Manager and the Google Sheets ID
from the runtime environment variable.
Because our cloud function is unauthenticated,
we'll verify that the request came from Stripe.
Since our custom dashboard requires more data
than what Stripe provides by default
or as a part of the Getting Started example,
we'll make an additional call-out to Stripe.
And now we can perform some lightweight ETL--
for example, grab just the salient info
from the checkout object and format it as appropriate.
And, lastly, insert the new row into our Google Sheet.
Now let's deploy our function.
Now that the function is ready, let's
copy the endpoint URL for Stripe to call.
Now we'll switch over to the Stripe Dashboard
to create the webhook that will invoke our cloud function
whenever a checkout occurs.
Let's add our function's endpoint
and configure this webhook to fire when a successful checkout
has completed event occurs.
Lastly, we'll copy the secret to verify that the request came
from Stripe.
Back in Secrets Manager in Google Cloud,
we'll create a new version for the webhook secret.
We'll use Latest so we do not have to redeploy our function
or make any code changes.
Now, let's see this in action.
A customer Jane in Tennessee is excited
that the company has opened sales in her area.
She visits the website.
She makes a quick card purchase, transacting
online using her credit card.
Rob, the business analyst in Google Sheets,
can now see it update in real time.
Because minimum instances in Cloud Functions was set to 1,
there is already a warm instance ready to process the request.
Rob sees a small blue dot in Tennessee
to indicate the company's first sale there,
and he also sees the revenue per product versus units change.
And, lastly, there is also a spike in revenue by date.
As more sales from across the United States come in,
Rob can see the Google Sheet dashboard update in real time.
He confidently reports to his leadership
that the planned expansion is a success, and indeed it is.
Thank you.
I hope you found this demo helpful.
To summarize, serverless products from Google,
like Cloud Functions and Eventarc,
accelerate your time to market.
There are no servers to provision, manage, batch,
or update.
You pay only while your code runs.
The system auto-scales, it's highly available,
it is fault tolerant, and Cloud Functions connects and extends
cloud services that you use.
I look forward to having you try out
the new features we released to accelerate your time to value
from the applications that you create and manage.
Just write your code snippets, and let Google Cloud
take care of the rest for you.
Thank you.
[MUSIC PLAYING]