GCP Fund Module 7 Developing, Deploying, and Monitoring in The Cloud
GCP Fund Module 7 Developing, Deploying, and Monitoring in The Cloud
Infrastructure
Developing, Deploying,
and Monitoring in the
Cloud
Agenda
Development in the cloud
Deployment: Infrastructure as
code
Monitoring: Proactive
instrumentation
Lab
Cloud Source Repositories
● Fully featured Git repositories
hosted on Google Cloud Platform
● Supports collaborative
development of cloud apps
● Includes integration with
Stackdriver Debugger
With Cloud Source Repositories, you can have any number of private Git
repositories, which allows you to organize the code associated with your cloud
project in whatever way works best for you. Google Cloud diagnostics tools
like the Debugger and Error Reporting can use the code from your Git
repositories to let you track down issues to specific errors in your deployed
code without slowing down your users. If you’ve already got your code in
GitHub or BitBucket repositories, you can bring that into your cloud project and
use it just like any other repository, including browsing and diagnostics.
Cloud Functions
● Create single-purpose functions
that respond to events without a
server or runtime
○ Event examples: New
instance created, file added
to Cloud Storage
● Written in Javascript, Python or
Go; execute in managed Node.js
environment on Google Cloud
Platform
You are billed, to the nearest 100 milliseconds, only while your code is running.
Cloud Events are things that happen in your cloud environment. These might
be things like changes to data in a database, files added to a storage system,
or a new virtual machine instance being created.
Deployment: Infrastructure as
code
Monitoring: Proactive
instrumentation
Lab
Deployment Manager
● Infrastructure management
service
● Create a .yaml template
describing your environment and
use Deployment Manager to
create resources
● Provides repeatable deployments
To use Deployment Manager, you create a template file, using either the YAML
markup language or Python, that describes what you want the components of
your environment to look like. Then you give the template to Deployment
Manager, which figures out and does the actions needed to create the
environment your template describes. If you need to change your environment,
edit your template, and then tell Deployment Manager to update the
environment to match the change.
Here’s a tip: you can store and version-control your Deployment Manager
templates in Cloud Source Repositories.
Agenda
Development in the cloud
Deployment: Infrastructure as
code
Monitoring: Proactive
instrumentation
Lab
Monitoring Logging Debug
You can’t run an application stably without monitoring. Monitoring lets you figure out
whether the changes you made were good or bad. It lets you respond with information
rather than with panic when one of your end users complains that your application is
down.
Stackdriver is GCP’s tool for monitoring, logging, and diagnostics. Stackdriver gives
you access to many different kinds of signals from your infrastructure platforms, virtual
machines, containers, middleware, and application tier: logs, metrics, traces. It gives
you insight into your application’s health, performance, and availability, so if issues
occur you can fix them faster.
Stackdriver offers capabilities in six areas
Logging Trace
Monitoring Platform, system, and application logs Latency reporting and sampling
Platform, system, and application Log search, view, filter, and export Per-URL latency and statistics
metrics Log-based metrics
Uptime/health checks
Dashboards and alerts
Debugger ProfilerBeta
Error Reporting Debug applications Continuous profiling of CPU and
Error Notifications memory consumption
Error dashboard
Here are the core components of Google Stackdriver: monitoring, logging, trace, error
reporting, and debugging.
Stackdriver Logging lets you view logs from your applications, and filter and search on
them. Logging also lets you define metrics based on log contents that are
incorporated into dashboards and alerts. You can also export logs to BigQuery, Cloud
Storage, and Cloud Pub/Sub.
Stackdriver Error Reporting tracks and groups the errors in your cloud applications ,
and it notifies you when new errors are detected.
With Stackdriver Trace, you can sample the latency of App Engine applications and
report per-URL statistics.
A painful way to debug an existing application is to go back into it and add lots of
logging statements. Stackdriver Debugger offers a different way. It connects your
application’s production data to your source code, so you can inspect its state of your
application at any code location in production. That means you can view the
application state without adding logging statements. Stackdriver Debugger works best
when your application’s source code is available, such as in Cloud Source
Repositories, although it can be in other repositories too.
To profile an application is to look at its execution of a program and observe the call
patterns between functions, how much CPU time each function consumes, and how
much memory is allocated for each. Stackdriver Profiler is a statistical, low-overhead
profiler that continuously gathers CPU usage and memory-allocation information from
your production applications. It attributes that information to the application's source
code, helping you identify the parts of the application consuming the most resources,
and otherwise illuminating the performance characteristics of the code. At the time of
this writing, Stackdriver Profiler is in beta. This means that it is not covered by any
SLA or deprecation policy and may be subject to backward-incompatible changes.
Agenda
Development in the cloud
Deployment: Infrastructure as
code
Monitoring: Proactive
instrumentation
Lab
Lab
In this lab you will create a
deployment using
Deployment Manager and
use it to maintain a
consistent state of your
deployment. You will also
view resource usage in a VM
instance using Stackdriver.
Lab Objectives
● Create a Deployment Manager
deployment.