Skip to main content

Kickoff of Day 1: Codematic's Hackathon with Google Cloud

Integrating Google Cloud into my hackathon journey

Updated 17 min readMarkdown
Kickoff of Day 1: Codematic's Hackathon with Google Cloud

Today marks the start of my Codematic Hackathon with Google Cloud. I've wanted to learn about Google Cloud Platform and its AI features for some time, and Codematic has provided the opportunity for this learning experience. I will be building a product that addresses a real-world problem in Nigeria by harnessing the power of Google Cloud, with the details to be shared at the end of the hackathon (for competitive reasons). You can also use this opportunity to learn about some services offered by Google Cloud. For now, let's explore the Google Cloud tools I'll be using for this hackathon.

In this article, we will explore the specific Google Cloud tools I'll be using in the hackathon, along with their purpose, functionality, and key features. Here is a list of the tools we will be using:

  • Google Cloud Run

  • Google Cloud Build

  • Google Cloud Artifact Registry

  • Google Cloud Scheduler.

  • Google Cloud SQL for PostgreSQL.

  • Google Cloud Storage.

  • Google Cloud SDK

But before we begin, let's discuss what Google Cloud is.

Google Cloud Logo

Google Cloud Platform (GCP)

According to Wikipedia, Google Cloud Platform (GCP) is a suite of cloud computing services offered by Google. It provides a wide array of modular services—including computing power, data storage, networking, big data, and machine learning tools—to help individuals and businesses build, deploy, and scale applications and workloads over the internet.

It is an extension of the Google family of products like Google Search, Gmail, and YouTube. It helps customers access it’s resources on-demand, typically on a pay-as-you-go basis, eliminating the need to manage physical IT infrastructure themselves.

Great, now that we know what Google Cloud is, let's continue.

Google Cloud Run Logo

Google Cloud Run

Google Cloud Run is a fully managed, serverless computing platform that lets you run containerized applications and event-driven workloads. Its primary purpose is to abstract away all infrastructure management, allowing developers to deploy code quickly and scale automatically. In simple terms, Google Cloud Run allows you to run your code, packaged as a container, without needing to manage any servers or infrastructure.

Purpose and Functionality

Cloud Run is designed to combine the flexibility of containers (allowing you to use any language, library, or binary) with the simplicity and cost-efficiency of a serverless platform.

ComponentPurposeFunctionality
Cloud Run ServicesTo execute code that responds to web requests (HTTPS endpoint).Handles web applications, APIs (REST, gRPC), and microservices. It scales instances based on incoming traffic, and can scale down to zero when idle to save costs.
Cloud Run JobsTo execute code that performs a specific, non-HTTP task and exits when finished.Handles batch processing, database migrations, data transformation, and scheduled tasks. It can run multiple identical tasks in parallel (Array jobs).

How it Works:

  1. You package your application code and its dependencies into a standard container image (like a Docker image).

  2. You deploy this image to a Cloud Run service or job.

  3. Cloud Run automatically provisions, manages, and scales the underlying compute resources (VMs, networking) for you. For services, an instance is created to handle an incoming request and shut down when the request is complete, billed only for the execution time.

Key Features

FeatureDescription
Fully Managed & ServerlessNo servers, operating systems, or cluster management (like Kubernetes) is required. Google handles patches, updates, and maintenance.
Auto-scaling to ZeroAutomatically scales up instantly to handle traffic surges and scales back down to zero when there's no traffic, minimizing costs.
Language AgnosticSince it uses containers, you can use any programming language, framework, or runtime environment.
Traffic ManagementAllows you to split incoming traffic between multiple revisions (versions) of your application for gradual rollouts and A/B testing.
Direct VPC AccessAllows your serverless application to securely connect to resources within your Virtual Private Cloud (VPC), like private databases.

Google Cloud Build Logo

Google Cloud Build

Google Cloud Build is a service within Google Cloud that automates the process of building, testing, and deploying your software. It acts as a serverless Continuous Integration/Continuous Delivery (CI/CD) platform, meaning you don't need to manage any servers or infrastructure yourself.

Purpose

Cloud Build's main purpose is to automate the entire software development workflow, from code commit to deployment, across any language or environment. It allows developers to:

  • Build artifacts (like container images, executables, or archives) from source code.

  • Test code (unit tests, integration tests) in a clean, consistent environment.

  • Deploy the resulting artifacts to various targets, such as Cloud Run, Google Kubernetes Engine (GKE), or Firebase.

Functionality

Cloud Build functions by executing a series of steps defined in a build configuration file (typically cloudbuild.yaml or cloudbuild.json).

  • Build Steps: Each step in the build configuration is executed as a Docker container. This container-based approach makes the build process highly flexible, as you can use any tool available in a Docker image. Google provides pre-built "builder" images for common tools (like gcloud, docker, npm, git), and you can use any public or private container image.

  • Source Code Integration: Cloud Build can automatically trigger a build when code is pushed to a connected repository. It integrates natively with Cloud Source Repositories, GitHub, and Bitbucket.

  • Workspace Persistence: Although each build step runs in an isolated container, Cloud Build provides a shared, ephemeral workspace (/workspace) where files and artifacts can be passed from one step to the next (e.g., source code is downloaded in the first step and compiled in the next).

  • Artifacts: The final output of a build (such as a container image or an archive) is stored in Google Cloud's artifact management services, like Artifact Registry or Cloud Storage.

Key Features

FeatureDescription
Serverless & ManagedNo infrastructure (like Jenkins servers or build agents) to provision, scale, or maintain. It automatically scales to meet demand.
IntegrationsDeep, native integration with other Google Cloud services (IAM, Cloud Run, GKE, Artifact Registry, etc.) for secure and streamlined workflows.
Build TriggersAutomated pipeline initiation based on events like code pushes, pull requests, or tags from integrated source repositories.
Custom Build StepsThe ability to define any build logic using custom container images, giving you complete control over your tools and environment.
Private PoolsA feature that allows you to run builds on a private, dedicated network with custom machine types, which is useful for accessing on-premises resources or meeting specific security requirements.
VPC Service ControlsEnhanced security options to mitigate the risk of data exfiltration for highly sensitive workloads.

Artifact Registry

Google Cloud Artifact Registry

Google Cloud Artifact Registry is a fully managed service that provides a centralized repository to securely store, manage, and secure your software artifacts at scale. Think of it as a digital library for all the components you use to build and deploy your applications.

Purpose

The primary purpose of Artifact Registry is to serve as a universal artifact repository for the entire software development lifecycle (SDLC). It allows developers to:

  • Centralize all their package formats (Docker images, Maven, npm, Python packages, etc.) in one service.

  • Securely manage build artifacts used in Continuous Integration and Continuous Deployment (CI/CD) pipelines.

  • Improve consistency and reliability by providing a standard, scalable, and highly integrated way to store and retrieve application dependencies and deployable images.

Functionality

Artifact Registry works by allowing you to create multiple repositories within your Google Cloud projects, each dedicated to a specific artifact format or purpose (e.g., a "docker" repository for containers, an "npm" repository for Node.js packages).

  1. Repository Creation: You define a repository, specifying its region and the artifact format it will support (e.g., Docker, Maven, etc.).

  2. Artifact Upload: Tools like Docker, Maven's mvn, or npm's npm can be configured to interact directly with the registry's endpoint. When a build is complete (e.g., via Cloud Build), the resulting artifact is pushed to the designated repository.

  3. Artifact Download: Deployment tools (like Cloud Run or GKE) or other developer tools pull the required artifacts from the registry during the deployment process.

  4. Access Control: Access to push or pull artifacts is managed using Identity and Access Management (IAM), allowing for fine-grained, repository-level security policies.

Key Features

FeatureDescription
Multi-Format SupportSupports all major artifact formats, including Docker images, Maven and Gradle packages, npm packages, Python packages (PyPI), and Debian and RPM packages.
IAM IntegrationProvides repository-level access control using IAM, enabling precise permissions (e.g., read-only access for production, read/write for CI/CD tools).
RegionalizationRepositories can be created in specific regions or multi-regions to place artifacts closer to deployment environments for lower latency and better disaster recovery.
Vulnerability ScanningContainer Analysis integration automatically scans container images for known vulnerabilities.
Audit LoggingIntegrates with Cloud Audit Logs to track all actions performed on artifacts, which is crucial for compliance and security auditing.
Remote RepositoriesAllows you to proxy and cache artifacts from public sources (like Docker Hub or Maven Central), which improves build speed and protects you from upstream outages.

Google Cloud Scheduler

Google Cloud Scheduler is a fully managed, enterprise-grade cron job service that allows you to schedule virtually any job, including batch, big data, and cloud infrastructure operations. It is designed to automate recurring tasks with high reliability and minimal operational overhead.

Purpose

The primary purpose of Cloud Scheduler is to act as a centralized, robust scheduler for time-based events across the Google Cloud Platform and beyond. It eliminates the need for managing traditional operating system-level cron services.

Typical use cases include:

  • System Maintenance: Scheduling daily backups, rotating logs, or triggering cleanup jobs to delete old data.

  • Data Processing: Initiating nightly ETL (Extract, Transform, Load) or batch processing pipelines.

  • Cost Optimization: Automating the startup or shutdown of Compute Engine VMs to reduce costs during off-hours.

  • External Integration: Triggering third-party web services at regular intervals.

Functionality

Cloud Scheduler's core functionality is to create and manage "cron jobs" that execute reliably on a recurring schedule.

  1. Schedule Definition: You define the execution time using the standard Unix cron format (e.g., 0 9 * * 1-5 for 9:00 AM on weekdays) and select a timezone.

  2. Target Invocation: At the scheduled time, the job is executed by sending a request to a defined target. Cloud Scheduler supports three main target types:

    • HTTP/S endpoints: Sends a request to any public or private HTTP URL (e.g., a service running on Cloud Run, GKE, or even an external service). Authentication via OAuth/OIDC tokens is supported for secure calls.

    • Cloud Pub/Sub topics: Publishes a message to a specified Pub/Sub topic, which can then trigger multiple downstream services (like Cloud Functions or Cloud Run services).

      (Pub/Sub is an asynchronous and scalable messaging service that decouples services producing messages from services processing those messages)

    • App Engine HTTP/S applications: Sends a request directly to an App Engine service.

  3. Reliability and Retries: The service is built for "at-least-once" delivery. If the target does not return a success code (e.g., HTTP 2xx), the job automatically retries according to a configurable policy, ensuring the task is eventually executed.

Key Features

FeatureDescription
Fully Managed & ServerlessNo infrastructure (VMs, OS, crontab files) to provision, patch, or scale. Google manages all the resources.
Standard Cron FormatSchedules are defined using the familiar and flexible Unix cron string format.
Target FlexibilitySupports triggering HTTP endpoints (anywhere), Pub/Sub topics, and App Engine services, making it a universal cloud job scheduler.
Retry PolicyConfigurable retry behavior with exponential backoff on failure, greatly increasing job reliability.
SecuritySupports OAuth/OIDC authentication for secure invocation of HTTP targets, especially for internal services like Cloud Run.
Logging & MonitoringIntegrates natively with Cloud Monitoring and Cloud Logging for a central view of job execution status, errors, and performance.

Google Cloud SQL for PostgreSQL

Google Cloud SQL for PostgreSQL is a fully managed, enterprise-ready relational database service that makes it easy to set up, maintain, manage, and administer your PostgreSQL databases on the Google Cloud Platform (GCP). It automates complex, time-consuming tasks so you can focus on building applications.

Purpose

The main purpose of Cloud SQL for PostgreSQL is to provide a relentlessly reliable, scalable, and secure database environment without the operational burden of self-managing a database. It serves as a drop-in replacement for the community version of PostgreSQL, allowing developers to use their familiar tools and codebase while benefiting from Google Cloud's infrastructure and automation.

Common use cases include:

  • Transactional Workloads: Serving as the primary backend database for high-traffic web and mobile applications.

  • Data-Intensive Applications: Running applications that heavily rely on advanced PostgreSQL features like PostGIS for geospatial data.

  • Modernizing Legacy Apps: Migrating existing on-premises or self-managed PostgreSQL databases to a fully managed cloud environment.

  • Gen AI Applications: Using the pgvector extension to build vector search capabilities directly into the database.

Functionality

Cloud SQL for PostgreSQL manages all the underlying infrastructure and database operations, providing a seamless PostgreSQL experience:

  1. Instance Provisioning: Users select the PostgreSQL version, machine type (CPU/memory), and storage capacity (which can auto-scale).

  2. Automated Management: Once provisioned, Cloud SQL automatically handles:

    • Patching and Updates: Applying software updates and security patches.

    • Backups and Recovery: Scheduling automatic daily backups and enabling Point-in-Time Recovery (PITR).

    • High Availability (HA): Configuring a standby instance in a different zone for automatic failover in case of a zone outage.

    • Storage Management: Automatically increasing storage capacity when the limit is approached.

  3. Connection: Applications and users connect to the Cloud SQL instance using standard PostgreSQL client-server protocols, typically secured via Private IP networking or the Cloud SQL Auth Proxy for authenticated and encrypted connections.

  4. Scaling: Instances can be scaled vertically (increasing CPU/memory) with minimal downtime, and Read Replicas can be created to distribute read traffic and improve performance.

Key Features

FeatureDescription
Fully ManagedAutomates administrative tasks like backups, updates, patching, encryption, and capacity management.
High Availability & DRProvides a 99.95% SLA (up to 99.99% with Enterprise Plus) with automatic failover to a standby instance in a different zone.
SecurityData is encrypted at rest (using AES-256) and in transit. Supports VPC networking, firewall protection, and IAM Database Authentication for user access control.
Vector SearchBuilt-in support for the pgvector extension, allowing for the storage and efficient search of vector embeddings for Generative AI applications.
Read ReplicasEasily create copies of the primary instance to handle read traffic, reducing the load on the primary database and improving global performance.
Cloud SQL InsightsProvides database observability, including visual query plans and metrics, to help quickly identify and resolve performance bottlenecks.
CompatibilityFull support for all major PostgreSQL versions and a wide range of popular extensions (e.g., PostGIS, hstore, PL/pgSQL).

Google Cloud Storage

Google Cloud Storage (GCS) is a highly durable, scalable, and secure object storage service for storing unstructured data of any type and size.

Purpose

The primary purpose of Cloud Storage is to offer unlimited, globally accessible, and highly reliable storage for digital assets. It's designed to handle massive volumes of data, from a few kilobytes to petabytes, and provides varying storage classes to optimize for cost and access frequency.

Key use cases include:

  • Data Lake: Storing raw, unstructured data for large-scale data analytics (e.g., with BigQuery).

  • Backup and Disaster Recovery: Providing a durable and cost-effective location for backing up critical data and archives.

  • Content Distribution: Hosting website assets, images, and video files for serving content globally with low latency.

  • Media Storage: Storing and streaming large media files for applications.

Functionality

Cloud Storage operates as an object store, managing data as objects within containers called buckets.

  1. Buckets: When you store data, you create a bucket in a specific geographic location (Regional, Dual-Region, or Multi-Region). The bucket acts as a fundamental container for your data.

  2. Objects: An object is the actual data (e.g., a file, image, or video) and its associated metadata. Objects are immutable—if you "update" an object, you're actually saving a new version of it.

  3. Access: Data is accessed via a single, unified API (RESTful API, command-line tools like gsutil, or client libraries), regardless of the storage class or the data's geographic location.8 This ensures consistent and low-latency access.

  4. Automatic Scalability: Cloud Storage is designed to scale without limits, so you don't need to provision capacity; you simply pay for what you use.

  5. Durability and Redundancy: Google automatically ensures high durability (99.999999999% or 11 nines) by redundantly storing and checksumming data across multiple devices in different data centers.

Key Features and Storage Classes

Key Features

  • Security: Data is encrypted by default at rest and in transit (using HTTPS/TLS). Offers granular access control using IAM (Identity and Access Management) policies.

  • Object Versioning: Automatically keeps older copies of objects when they are deleted or overwritten, providing protection against accidental loss.

  • Lifecycle Management: Allows you to define policies to automatically transition data to lower-cost storage classes or delete objects after a specified period, optimizing costs.

  • Strong Consistency: Guarantees that once a write operation succeeds, subsequent read operations will see the latest version of the data, which is critical for analytics and data pipelines.

Storage Classes
Cloud Storage offers four main storage classes, allowing you to optimize cost based on your data access frequency:

Storage ClassBest ForAccess FrequencyCostMinimum Storage Duration
Standard"Hot" data, high-performance workloads, websites.Frequently accessed (multiple times a month).Highest storage cost, lowest access cost.None
NearlineInfrequently accessed data, monthly backups.Accessed less than once a month.Lower storage cost, higher retrieval cost.30 days
ColdlineDisaster recovery, less frequent backups.Accessed at most once every 90 days.Very low storage cost, highest retrieval cost.90 days
ArchiveLong-term archiving, regulatory compliance.Accessed less than once a year.Lowest storage cost, very high retrieval cost.365 days

Google Cloud SDK

The Google Cloud Software Development Kit (SDK) is a collection of command-line tools and libraries that you use to interact with and manage Google Cloud resources and services.

Purpose

The primary purpose of the Google Cloud SDK is to provide a unified, programmatic way for developers, system administrators, and cloud engineers to manage and automate tasks on Google Cloud Platform (GCP) from their local machine or a scripting environment. It allows you to:

  • Manage Resources: Create, modify, and delete resources like virtual machines (VMs), storage buckets, databases, and more.

  • Automate Workflows: Write scripts to automate repetitive tasks, such as deploying applications or managing backup processes.

  • Develop Locally: Facilitate local development and testing by integrating your local environment with the cloud.

Functionality

The Cloud SDK's core functionality is delivered through its main command-line tools, which translate your commands into API calls to Google Cloud services:

  • Authentication: The SDK handles the authentication process, allowing you to securely log in with your Google Account and manage resources based on your Identity and Access Management (IAM) permissions.

  • Configuration: It allows you to set configurations like the default project, region, and zone for all your commands, simplifying your workflow.

  • Component Manager: The SDK includes a component manager that lets you easily install, update, and manage additional tools and components for specific Google Cloud services.

  • Integration: The tools are designed to be run interactively in a terminal or non-interactively within automated scripts, making them a central part of CI/CD pipelines and DevOps workflows.

Key Features and Components

Key Components
The Google Cloud SDK bundles several specialized command-line tools:

ToolPurposeExample Services
gcloud CLIThe main command-line interface for managing most Google Cloud services.Compute Engine, App Engine, Google Kubernetes Engine (GKE), Networking, IAM.
gsutilA tool for managing Cloud Storage buckets and objects (files).Cloud Storage.
bqA command-line tool for running queries, managing datasets, and manipulating data in BigQuery.BigQuery.

Key Features

  • Unified Interface: A single set of tools to control all major Google Cloud services.

  • Easy Installation and Update: Available for Windows, macOS, and Linux, with built-in commands (gcloud components update) for seamless updates.

  • Secure Authentication: Uses OAuth2 for secure authentication and authorization with your Google Account.

  • Pre-installed in Cloud Shell: The Cloud SDK is always available, up-to-date, and fully authenticated in the Google Cloud Shell, a browser-based terminal environment.

  • Client Libraries: While the SDK focuses on command-line tools, the associated Cloud Client Libraries (for Python, Java, Node.js, etc.) are available for developers who want to write idiomatic code to interact with Google Cloud APIs directly within their applications.

Conclusion and Continuation

The tools listed above are Google Cloud services/products that will help me complete important tasks in the hackathon, such as running my microservices, deploying a containerized Docker file, storing my files (objects), scheduling recurring tasks automatically, building and testing my software artifacts, and many others. In the next article, we will explore tools that aren't from Google Cloud Services that we will be using.

Now that you have a good understanding of Google Cloud, you can start taking leverage of Google Cloud by creating your app and deploying it to Google Cloud Run on the Google Cloud Platform. See you in the next article!

About the author

  • Fortune Precious is a software engineer skilled in TypeScript, C++, Python, Rust, Java and C#. He has interests in products, data and research.

No comments yet. Be the first to comment.