<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Puy P on Medium]]></title>
        <description><![CDATA[Stories by Puy P on Medium]]></description>
        <link>https://medium.com/@puy-prachya?source=rss-d8a24ce06f2e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*tDxdNqM8MxVILmaB</url>
            <title>Stories by Puy P on Medium</title>
            <link>https://medium.com/@puy-prachya?source=rss-d8a24ce06f2e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 22:41:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@puy-prachya/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Journey Log: Setup & Deploy Web App / API / Let’s Encrypt on VPS with Dockers and Auto Deploy from…]]></title>
            <link>https://puy-prachya.medium.com/journey-log-setup-deploy-web-app-api-lets-encrypt-on-vps-with-dockers-and-auto-deploy-from-c808a7652c86?source=rss-d8a24ce06f2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c808a7652c86</guid>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[vps]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[containers]]></category>
            <dc:creator><![CDATA[Puy P]]></dc:creator>
            <pubDate>Tue, 21 Apr 2026 07:41:42 GMT</pubDate>
            <atom:updated>2026-04-21T07:44:09.987Z</atom:updated>
            <content:encoded><![CDATA[<h3>Journey Log: Setup &amp; Deploy Web App / API / Let’s Encrypt on VPS with Dockers and Auto Deploy from GitLab Container Registry</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cr8FgaVb2p877YA7jbLt_w.jpeg" /></figure><p>This content is step to set up and deploy the web and service include database on standalone server with dockerize from scratch.</p><p>In this VPS, I will deploy the platform that includes: web app (nuxt), api (nestjs), and db (mysql). For auto deploy, will use watchtower (auto-updater), with GitLab container registry. Also include setup ssl with Let’s Encrypt for https.</p><p>For SSH, I will use Remote — SSH extension in VS Code to access VPS.</p><p>After receive the VPS credential.</p><p><strong>Phase 1: Security &amp; VPS Initialization</strong></p><p>Login into VPS via SSH as root for set up security layer.</p><p>1. Update the system</p><pre>apt update &amp;&amp; apt upgrade -y</pre><p>(If prompted about ssh_config, select &quot;keep the local version currently installed&quot;).</p><p>2. Create the Non-Root user (In this blog example is myadmin)</p><pre>adduser myadmin</pre><p>(Follow the prompts to set a strong password).</p><p>3. Grant Admin (Sudo) Privileges</p><pre>usermod -aG sudo myadmin</pre><p>4. Prepare the Application Directory</p><p>Instead of putting files in a personal home folder, I will create a system folder for the application and give ownership to the new user.</p><pre>mkdir -p /opt/xyz-platform<br>chown -R myadmin:myadmin /opt/xyz-platform</pre><p>Create another system folder for the database and give to the new user.</p><pre>mkdir -p /opt/database<br>chown -R myadmin:myadmin /opt/database</pre><p>5. Switch to VS Code Remote SSH</p><p>Ok, I done with the root user for this part 1.</p><p>5.1 Open VS Code on local machine.</p><p>5.2 Use the Remote — SSH extension.</p><p>5.3 Connect to: ssh myadmin@vps-ip .</p><p>5.4 After connected, open the folder /opt/xyz-platform. All terminal commands should be executed inside the VS Code terminal as the myadmin user.</p><p><strong>Phase 2: Install Docker &amp; Authenticate Gitlab</strong></p><p>1. Install Docker &amp; Add Permissions</p><p>Run the commands to install Docker and give myadmin user permission to use it.:</p><pre># Install Docker<br>curl -fsSL https://get.docker.com -o get-docker.sh<br>sudo sh get-docker.sh</pre><pre># Add myadmin to the Docker group<br>sudo usermod -aG docker myadmin</pre><p>(Noted: Close VS Code and Reconnect via SSH for the Docker group permission to take effect.)</p><p>2. Authenticate the Server with GitLab</p><p>Because GitLab that will use is private, the server needs permission to pull images.</p><p>Go to <strong>GitLab project -&gt; Settings -&gt; Repository -&gt; Deploy Tokens.</strong></p><p>Create a token with the read_registry scope.</p><p>In VS Code with connected SSH to VPS terminal. Run this command:</p><pre>docker login registry.gitlab.com -u &lt;your-deploy-token-username&gt; -p &lt;your-deploy-token-password&gt;</pre><p>This will saves an auth file at ~/.docker/config.json, which Watchtower (service for looking for new image from GitLab Image Registry) will use to pull new updates.</p><p><strong>Phase 3: Pushing Images to GitLab (CI/CD)</strong></p><p>To get images into Gitlab, I will create a .gitlab-ci.yml file in web app and api repositories. GitLab automatically provides variables like $CI_REGISTRY to handle authentication.</p><p>Create the .gitlab-ci.yml file in the root of each repository.</p><pre>stages:<br>  - build-and-push</pre><pre>variables:<br>  # This tags your image with the commit hash and &quot;latest&quot;<br>  IMAGE_TAG: $CI_REGISTRY_IMAGE:latest </pre><pre>build-docker-image:<br>  stage: build-and-push<br>  image: docker:24.0.5<br>  services:<br>    - docker:24.0.5-dind<br>  before_script:<br>    - docker login -u &quot;$CI_REGISTRY_USER&quot; -p &quot;$CI_REGISTRY_PASSWORD&quot; $CI_REGISTRY<br>  script:<br>    - docker build -t $IMAGE_TAG .<br>    - docker push $IMAGE_TAG<br>  only:<br>    - main # Only deploy when code is pushed to the main branch</pre><p>When push code to main branch, GitLab will automatically build Dockerfile and store the image in project&#39; Container Registry.</p><p><strong>Phase 4: Database Docker Setup</strong></p><p>To secure in Docker without exposing database to the public internet, use an <strong>External Docker Network</strong>. This will acts as a private virtual bridge connect the database into any other docker-compose.</p><p>1. Create the Private Network</p><p>Create a new virtual network. For any container connected to this network will be able to talk to each other using container names. Run this command.</p><pre>docker network create db-network</pre><p>2. Create the database docker-compose.yml</p><p>Connect VS Code Remote SSH into /opt/database the directory that created at first step. Create a .env file here with master database credentials, then create the docker-compose.yml:</p><pre>version: &#39;3.8&#39;</pre><pre>services:<br>  mysql:<br>    image: mysql:8.0<br>    container_name: mysql-db<br>    restart: always<br>    environment:<br>      TZ: Asia/Bangkok<br>      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}<br>      MYSQL_DATABASE: ${DB_NAME}<br>      MYSQL_USER: ${DB_USERNAME}<br>      MYSQL_PASSWORD: ${DB_PASSWORD}<br>    command: --default-time-zone=&#39;+07:00&#39;<br>    volumes:<br>      - global_mysql_data:/var/lib/mysql<br>    networks:<br>      - db-network<br>    # Exposing the port is optional. Only do this if you need to <br>    # connect from DBeaver/PgAdmin on your local computer.<br>    ports:<br>      - &quot;3306:3306&quot; </pre><pre>volumes:<br>  mysql_data:</pre><pre>networks:<br>  # This tells Docker NOT to create a new network, but to connect to the one we made in Step 1<br>  global-db-network:<br>    external: true</pre><p>3. Boot the database:</p><pre>docker compose up -d</pre><p>Database will running permanently in the background.</p><p><strong>Phase 5: Web and API with Auto Deploy</strong></p><p>Go back to server inside /opt/xyz-platform, create docker-compose.yml file.</p><p>This file will orchestrates web app, api, and Watchtower (the audo-updater). Don’t forgot to change image registry url.</p><pre>version: &#39;3.8&#39;</pre><pre>services:<br>  api:<br>    image: registry.gitlab.com/username/api-nest-repo:latest<br>    container_name: api<br>    restart: always<br>    env_file: <br>      - .env<br>    ports:<br>      - &quot;9001:3000&quot;<br>    networks:<br>      - db-network<br>    labels:<br>    - &quot;com.centurylinklabs.watchtower.enable=true&quot;</pre><pre>  web:<br>    image: registry.gitlab.com/username/web-nuxt-repo:latest<br>    container_name: web<br>    restart: always<br>    env_file: .env<br>    ports:<br>      - &quot;9000:3000&quot;<br>    labels:<br>    - &quot;com.centurylinklabs.watchtower.enable=true&quot;</pre><pre>  # # The Auto-Deployer<br>  watchtower:<br>    image: containrrr/watchtower<br>    container_name: watchtower<br>    restart: always<br>    environment:<br>      - DOCKER_API_VERSION=1.41<br>      - WATCHTOWER_CLEANUP=true<br>      - WATCHTOWER_POLL_INTERVAL=60<br>      - WATCHTOWER_LABEL_ENABLE=true<br>    volumes:<br>      - /var/run/docker.sock:/var/run/docker.sock<br>      # This passes your GitLab login credentials into Watchtower<br>      - /home/deployer/.docker/config.json:/config.json<br>      # it gracefully shuts down the old container and boots the new one.</pre><pre>networks:<br>  db-network:<br>    external: true</pre><p>Create a .env file in the same folder with api and web credentials.</p><p>The database lives in /opt/database that boot in previous step and will nerver touch it again unless update or configuration.</p><p>The app lives in /opt/xyz-platform that will connect to mysql from /opt/database with network db-network.</p><p>Boot the platform:</p><pre>docker compose up -d</pre><p>If want to shutdown, use this command.</p><pre>docker compose down</pre><p>Now, we can access our platform web and api via VPS ip address with expose public internet ports. (9000 for web, 9001 for api, next step I will securely with SSL and close public port).</p><p><strong>Phase 6: HTTPS via Let’s Encrypt (Nginx &amp; Certbot) with Dockerize</strong></p><p>Finally, we need to expose Docker containers to the web securely. Nginx will act as the reverse proxy, and Certbot will automatically install and renew the Let’s Encrypt SSL certificates. When container Nginx with Let’s Encrypt, we need to vaoid writing manual nginx.conf files entirely, Instead, we use the nginx-proxy and acme-companion stack. These 2 containers will monitor Docker system. When they see Nuxt or NestJS containers turn on, they will automatically generate the Nginx routing rules and fetch the Let&#39;s Encrypt certificates based on hidden environment variables.</p><p>1. Create the web network</p><p>Like we created a db-network, so the API cloud talk to database securely in the background, we need a network so the Proxy can talk to the apps without exposing their ports to the public internet.</p><p>In VS Code Remote SSH terminal of VPS, Run this command.</p><pre>docker network create web-network</pre><p>2. Build the Automated Proxy Stack</p><p>Put Nginx in its own dedicated folder so it acts as the centrailzed traffic cop for the whole server.</p><p>2.1 Create the folder:</p><pre>mkdir -p /opt/reverse-proxy<br>cd /opt/reverse-proxy</pre><p>2.2 Create the Proxy docker-compose.yml</p><p>Open VS Code Remote SSH with new folder (/opt/reverse-proxy), and create the file with this configuration. Don&#39;t forgot to change myemail@email.com so Let&#39;s Encrypt can register the certificates securely.</p><pre>version: &#39;3.8&#39;</pre><pre>services:<br>  nginx-proxy:<br>    image: nginxproxy/nginx-proxy:alpine<br>    container_name: nginx-proxy<br>    restart: always<br>    ports:<br>      # This container is the ONLY thing exposed to the public internet<br>      - &quot;80:80&quot;<br>      - &quot;443:443&quot;<br>    volumes:<br>      - conf:/etc/nginx/conf.d<br>      - vhost:/etc/nginx/vhost.d<br>      - html:/usr/share/nginx/html<br>      - certs:/etc/nginx/certs:ro<br>      - /var/run/docker.sock:/tmp/docker.sock:ro<br>    networks:<br>      - web-network</pre><pre>  acme-companion:<br>    image: nginxproxy/acme-companion<br>    container_name: nginx-acme-companion<br>    restart: always<br>    environment:<br>      # Required by Let&#39;s Encrypt<br>      - DEFAULT_EMAIL=myemail@example.com <br>    volumes_from:<br>      - nginx-proxy<br>    volumes:<br>      - certs:/etc/nginx/certs:rw<br>      - acme:/etc/acme.sh<br>      - /var/run/docker.sock:/var/run/docker.sock:ro<br>    networks:<br>      - web-network<br>    depends_on:<br>      - nginx-proxy</pre><pre>volumes:<br>  conf:<br>  vhost:<br>  html:<br>  certs:<br>  acme:</pre><pre>networks:<br>  web-network:<br>    external: true</pre><p>2.3 Start the Proxy Engine</p><pre>docker compose up -d</pre><p>Nginx is now running and waiting for apps to be reach.</p><p>2.4 (Optional) Custom config for Nginx</p><p>In /opt/reverse-proxy, create custom_nginx.conf for custom Nginx.</p><p>Update docker-compose.yml in volumes section for custom config.</p><pre>volumes:<br>      - ./custom_nginx.conf:/etc/nginx/conf.d/custom_nginx.conf:ro</pre><p>Final docker-compose.yml of reverse-proxy should be like this.</p><pre>version: &#39;3.8&#39;</pre><pre>services:<br>  nginx-proxy:<br>    image: nginxproxy/nginx-proxy:alpine<br>    container_name: nginx-proxy<br>    restart: always<br>    ports:<br>      # This container is the ONLY thing exposed to the public internet<br>      - &quot;80:80&quot;<br>      - &quot;443:443&quot;<br>    volumes:<br>      - conf:/etc/nginx/conf.d<br>      - ./custom_nginx.conf:/etc/nginx/conf.d/custom_nginx.conf:ro<br>      - vhost:/etc/nginx/vhost.d<br>      - html:/usr/share/nginx/html<br>      - certs:/etc/nginx/certs:ro<br>      - /var/run/docker.sock:/tmp/docker.sock:ro<br>    networks:<br>      - global-web-network<br></pre><pre>  acme-companion:<br>     # Same as previous acme-companion</pre><pre>volumes:<br>  # Same as previous volumes</pre><pre>networks:<br>  # Same as previous networks</pre><p>3. Update the Platform Stack</p><p>Go back to main platform folder to attach platform both web and api to the new proxy.</p><p>3.1 Navigate to the app platform folder (/opt/xyz-platform)</p><p>3.2 Update the docker-compose.yml</p><p>I will make three security updates here.</p><p>- Add the VIRTUAL_HOST and LETSENCRYPT_HOST variables, with platform api.domain.com, web.domain.com</p><p>- Remove the ports completely (your apps are now protected behind the proxy).</p><p>- Connect them to the web-network.</p><p>* If don’t has domain name, can use duckdns (<a href="https://www.duckdns.org/domains">https://www.duckdns.org/domains</a>) to create sub domain to testing.</p><pre>version: &#39;3.8&#39;</pre><pre>services:<br>  api:<br>    image: registry.gitlab.com/username/api-nest-repo:latest<br>    container_name: api<br>    restart: always<br>    env_file: <br>      - .env<br>    environment:<br>      # The MAGIC VARIABLES that trigger the auto-proxy and auto-SSL<br>      - VIRTUAL_HOST=api.domain.com<br>      - LETSENCRYPT_HOST=api.domain.com<br>      - VIRTUAL_PORT=3000<br>      - LETSENCRYPT_EMAIL=xyz-platform@domain.com<br>    networks:<br>      - db-network<br>      - web-network</pre><pre>  web:<br>    image: registry.gitlab.com/username/web-nuxt-repo:latest<br>    container_name: web<br>    restart: always<br>    env_file: .env<br>    environment:<br>      - VIRTUAL_HOST=web.domain.com<br>      - LETSENCRYPT_HOST=web.domain.com<br>      - VIRTUAL_PORT=3000<br>    networks:<br>      - web-network</pre><pre>  # # The Auto-Deployer<br>  watchtower:<br>    image: containrrr/watchtower<br>    container_name: watchtower<br>    restart: always<br>    environment:<br>      - DOCKER_API_VERSION=1.41<br>      - WATCHTOWER_CLEANUP=true<br>      - WATCHTOWER_POLL_INTERVAL=60<br>      - WATCHTOWER_LABEL_ENABLE=true<br>    volumes:<br>      - /var/run/docker.sock:/var/run/docker.sock<br>      # This passes your GitLab login credentials into Watchtower<br>      - /home/deployer/.docker/config.json:/config.json<br>      # it gracefully shuts down the old container and boots the new one.</pre><pre>networks:<br>  db-network:<br>    external: true<br>  web-network:<br>    external: true</pre><p>4. The Final Boot</p><p>Ensure .env of web is pointing to https://api.domain.com and api has CORS enabled for https://web.domain.com. Then apply new Docker:</p><pre>docker compose up -d</pre><p>Now, we can access our platform via domain name with https without expose internal port to public internet.</p><p>As for database, if we don’t want to expose port to public, we can delete the expose port config for database docker-compose.yml.</p><p>My Original Blog: <a href="https://www.piscessera.com/blog/journey-log-setup-deploy-web-app-api-on-vps-with-dockers-and-auto-deploy-from-gitlab-container-registry">https://www.piscessera.com/blog/journey-log-setup-deploy-web-app-api-on-vps-with-dockers-and-auto-deploy-from-gitlab-container-registry</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c808a7652c86" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Perform Predictive Data Analysis in BigQuery: Challenge Lab]]></title>
            <link>https://puy-prachya.medium.com/perform-predictive-data-analysis-in-bigquery-challenge-lab-45ad3ae86c37?source=rss-d8a24ce06f2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/45ad3ae86c37</guid>
            <category><![CDATA[googleskills]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[bigquery]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[google-cloud]]></category>
            <dc:creator><![CDATA[Puy P]]></dc:creator>
            <pubDate>Sun, 19 Apr 2026 20:06:12 GMT</pubDate>
            <atom:updated>2026-04-19T20:06:12.030Z</atom:updated>
            <content:encoded><![CDATA[<p>Lab Link: <a href="https://www.skills.google/course_templates/656/labs/600980">https://www.skills.google/course_templates/656/labs/600980</a></p><p><strong>Challenge scenario</strong></p><p>Use BigQuery to load the data from the Cloud Storage bucket, write and execute queries in BigQuery, analyze soccer event data. Then use BigQuery ML to train an expected goals model on the soccer event data and evaluate the impressiveness of World Cup goals.</p><p><strong>Preparation: Open Cloud Shell</strong></p><p>1. Open the Google Cloud Console in an <strong>Incognito/Private window</strong> using your lab credentials.</p><p>2. Click the <strong>Activate Cloud Shell</strong>.</p><p>3. If prompted, click <strong>Continue</strong>.</p><p>4. Once the terminal loads, set your project ID as a variable.</p><pre>export PROJECT_ID=$(gcloud config get-value project)</pre><p><strong>Task 1: Data Ingestion</strong></p><p>We need to create a BigQuery dataset named soccer and load several JSON and CSV files from a public Google Cloud Storage bucket into tables.</p><p>1. Create the soccer dataset.</p><pre>bq mk soccer</pre><p>2. Load the data into their respective tables by pasting this block of commands into Cloud Shell. Replace table name follow the lab specific.</p><pre>bq load --autodetect --source_format=NEWLINE_DELIMITED_JSON $PROJECT_ID:soccer.[TABLE_NAME] gs://spls/bq-soccer-analytics/events.json<br>   <br>bq load --autodetect --source_format=CSV $PROJECT_ID:soccer.[TABLE_NAME] gs://spls/bq-soccer-analytics/tags2name.csv</pre><p>We can go to big data to view the source of table that loaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JnXGl_YxBoqnmqfqcsKIqQ.png" /></figure><p><strong>Task 2: Analyze soccer data</strong></p><p>We need to write a query that calculates the penalty kick success rate for players who have attempted at least 5 penalty kicks.</p><p>Run this command in Cloud Shell to execute the query and save it to BigQuery’s history. Change table name to match event table name that lab specific.</p><pre>bq query --use_legacy_sql=false \<br>&quot;SELECT<br>  playerId,<br>  (Players.firstName || &#39; &#39; || Players.lastName) AS playerName,<br>  COUNT(id) AS numPKAtt,<br>  SUM(IF(101 IN UNNEST(tags.id), 1, 0)) AS numPKGoals,<br>  SAFE_DIVIDE(<br>    SUM(IF(101 IN UNNEST(tags.id), 1, 0)),<br>    COUNT(id)<br>  ) AS PKSuccessRate<br>FROM<br>  \`soccer.[EVENT_TABLE_NAME]\` Events<br>LEFT JOIN<br>  \`soccer.players\` Players ON Events.playerId = Players.wyId<br>WHERE<br>  eventName = &#39;Free Kick&#39; AND<br>  subEventName = &#39;Penalty&#39;<br>GROUP BY<br>  playerId, playerName<br>HAVING<br>  numPkAtt &gt;= 5<br>ORDER BY<br>  PKSuccessRate DESC, numPKAtt DESC;&quot;</pre><p><strong>Task 3: Gain insight by analyzing soccer data</strong></p><p>We need to analyze shot distances and calculate the probability of a shot becoming a goal based on its distance from the net.</p><p>Run this command in Cloud Shell. Change table name to match event table name that lab specific.</p><pre>bq query --use_legacy_sql=false \<br>&quot;WITH Shots AS (<br>  SELECT<br>    *,<br>    /* 101 is the known Tag for &#39;goals&#39; from goals table */<br>    101 IN UNNEST(tags.id) AS isGoal,<br>    /* Translate 0-100 (x,y) coordinate-based distances to absolute positions using pitch dimensions of 105x68 before combining in 2D distance calc */<br>    SQRT(<br>      POW(<br>        (100 - positions[ORDINAL(1)].x) * 105/100,<br>        2) +<br>      POW(<br>        (50 - positions[ORDINAL(1)].y) * 68/100,<br>        2)<br>    ) AS shotDistance<br>  FROM<br>    \`soccer.[EVENT_TABLE_NAME]\`<br>  WHERE<br>    /* Includes both &#39;open play&#39; and free kick shots (including penalties) */<br>    eventName = &#39;Shot&#39; OR<br>    (eventName = &#39;Free Kick&#39; AND subEventName IN (&#39;Free kick shot&#39;, &#39;Penalty&#39;))<br>)<br>SELECT<br>  ROUND(shotDistance, 0) AS ShotDistRound0,<br>  COUNT(*) AS numShots,<br>  SUM(IF(isGoal, 1, 0)) AS numGoals,<br>  AVG(IF(isGoal, 1, 0)) AS goalPct<br>FROM<br>  Shots<br>WHERE<br>  shotDistance &lt;= 50<br>GROUP BY<br>  ShotDistRound0<br>ORDER BY<br>  ShotDistRound0;&quot;</pre><p><strong>Task 4: Create a regression model using soccer data</strong></p><p>We need to create a Logistic Regression model to predict “Expected Goals” (xG) based on the shot distance and shot angle. First, we must create two User-Defined Functions (UDFs) to handle the math, and then train the model.</p><p>1. <strong>Create the UDFs and the Model</strong> by running this large command block in Cloud Shell. The lab will provide the function of GetShotDistanceToGoal and GetShotAngleToGoal. Include the require model name xg_logistic_reg_model. (Don&#39;t forgot and follow the lab instruction.) Replace function by function and model name from the lab to complete this task.</p><pre>bq query --use_legacy_sql=false \<br>&quot;CREATE FUNCTION \`soccer.GetShotDistanceToGoal538\`(x INT64, y INT64)<br>RETURNS FLOAT64<br>AS (<br> /* Translate 0-100 (x,y) coordinate-based distances to absolute positions */<br> SQRT(<br>   POW((100 - x) * 100/100, 2) +<br>   POW((55 - y) * 67/100, 2)<br> )<br>);</pre><pre>CREATE FUNCTION \`soccer.GetShotAngleToGoal538\`(x INT64, y INT64)<br>RETURNS FLOAT64<br>AS (<br> SAFE.ACOS(<br>   /* Have to translate 0-100 (x,y) coordinates to absolute positions using<br>   &quot;average&quot; field dimensions of 100x67 before using in various distance calcs */<br>   SAFE_DIVIDE(<br>     ( /* Squared distance between shot and 1 post, in meters */<br>       (POW(100 - (x * 100/100), 2) + POW(33.5 + (7.32/2) - (y * 67/100), 2)) +<br>       /* Squared distance between shot and other post, in meters */<br>       (POW(100 - (x * 100/100), 2) + POW(33.5 - (7.32/2) - (y * 67/100), 2)) -<br>       /* Squared length of goal opening, in meters */<br>       POW(7.32, 2)<br>     ),<br>     (2 *<br>       /* Distance between shot and 1 post, in meters */<br>       SQRT(POW(100 - (x * 100/100), 2) + POW(33.5 + 7.32/2 - (y * 67/100), 2)) *<br>       /* Distance between shot and other post, in meters */<br>       SQRT(POW(100 - (x * 100/100), 2) + POW(33.5 - 7.32/2 - (y * 67/100), 2))<br>     )<br>    )<br>  /* Translate radians to degrees */<br>  ) * 180 / ACOS(-1)<br> )<br>;</pre><pre>CREATE MODEL \`soccer.xg_logistic_reg_model_538\`<br>OPTIONS(<br> model_type = &#39;LOGISTIC_REG&#39;,<br> input_label_cols = [&#39;isGoal&#39;]<br>) AS<br>SELECT<br> Events.subEventName AS shotType,<br> /* 101 is known Tag for &#39;goals&#39; from goals table */<br> (101 IN UNNEST(Events.tags.id)) AS isGoal,<br> \`soccer.GetShotDistanceToGoal538\`(Events.positions[ORDINAL(1)].x,<br>   Events.positions[ORDINAL(1)].y) AS shotDistance,<br> \`soccer.GetShotAngleToGoal538\`(Events.positions[ORDINAL(1)].x,<br>   Events.positions[ORDINAL(1)].y) AS shotAngle<br>FROM<br> \`soccer.events538\` Events<br>LEFT JOIN<br> \`soccer.matches\` Matches ON Events.matchId = Matches.wyId<br>LEFT JOIN<br> \`soccer.competitions\` Competitions ON Matches.competitionId = Competitions.wyId<br>WHERE<br> /* Filter out World Cup matches for model fitting purposes */<br> Competitions.name != &#39;World Cup&#39; AND<br> (eventName = &#39;Shot&#39; OR (eventName = &#39;Free Kick&#39; AND subEventName IN (&#39;Free kick shot&#39;, &#39;Penalty&#39;)));&quot;</pre><p>(Note: BigQuery ML models take about 2–4 minutes to train. Wait for the command prompt to return before moving on)</p><p><strong>Task 5: Make predictions from new data with the BigQuery model</strong></p><p>Finally, we need to use the xg_logistic_reg_model we just trained to predict the probability of a goal for the World Cup data.</p><p>Run this command in Cloud Shell. Don’t forgot to check the function names, model name, and table name that the lab specific from previous tasks.</p><pre>bq query --use_legacy_sql=false \<br>&quot;SELECT<br> predicted_isGoal_probs[ORDINAL(1)].prob AS predictedGoalProb,<br> *<br>FROM<br> ML.PREDICT(<br>   MODEL \`soccer.xg_logistic_reg_model_538\`,<br>   (<br>    SELECT<br>      Events.playerId,<br>      (Players.firstName || &#39; &#39; || Players.lastName) AS playerName,<br>      Teams.name AS teamName,<br>      CAST(Matches.dateutc AS DATE) AS matchDate,<br>      Matches.label AS match,<br>      CASE<br>        WHEN Events.matchPeriod = &#39;1H&#39; THEN 0<br>        WHEN Events.matchPeriod = &#39;2H&#39; THEN 45<br>        WHEN Events.matchPeriod = &#39;E1&#39; THEN 90<br>        WHEN Events.matchPeriod = &#39;E2&#39; THEN 105<br>        WHEN Events.matchPeriod = &#39;P&#39; THEN 120<br>        ELSE 0<br>      END + CAST(CEIL(Events.eventSec / 60) AS INT64) AS matchMinute,      <br>      Events.subEventName AS shotType,<br>      (101 IN UNNEST(Events.tags.id)) AS isGoal,<br>      \`soccer.GetShotDistanceToGoal538\`(Events.positions[ORDINAL(1)].x,<br>          Events.positions[ORDINAL(1)].y) AS shotDistance,<br>      \`soccer.GetShotAngleToGoal538\`(Events.positions[ORDINAL(1)].x,<br>          Events.positions[ORDINAL(1)].y) AS shotAngle<br>    FROM<br>      \`soccer.events538\` Events<br>    LEFT JOIN<br>      \`soccer.matches\` Matches ON Events.matchId = Matches.wyId<br>    LEFT JOIN<br>      \`soccer.competitions\` Competitions ON Matches.competitionId = Competitions.wyId<br>    LEFT JOIN<br>      \`soccer.players\` Players ON Events.playerId = Players.wyId<br>    LEFT JOIN<br>      \`soccer.teams\` Teams ON Events.teamId = Teams.wyId<br>    WHERE<br>      Competitions.name = &#39;World Cup&#39; AND<br>      (eventName = &#39;Shot&#39; OR (eventName = &#39;Free Kick&#39; AND subEventName IN (&#39;Free kick shot&#39;, &#39;Penalty&#39;)))<br>   )<br> )<br>ORDER BY<br>  predictedgoalprob DESC;&quot;</pre><p>Everything we do will be on the Big Data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P8-brIU15jAp84qLqtaBaQ.png" /></figure><p>Congratulations! Complete the lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WoOEsE12PhTotgG4" /></figure><p>My Blog Content: <a href="https://www.piscessera.com/blog/perform-predictive-data-analysis-in-bigquery-challenge-lab">https://www.piscessera.com/blog/perform-predictive-data-analysis-in-bigquery-challenge-lab</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45ad3ae86c37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Engineer Data for Predictive Modeling with BigQuery ML: Challenge Lab]]></title>
            <link>https://puy-prachya.medium.com/engineer-data-for-predictive-modeling-with-bigquery-ml-challenge-lab-031c5f5aa7aa?source=rss-d8a24ce06f2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/031c5f5aa7aa</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[google-big-query]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[googleskills]]></category>
            <category><![CDATA[predictive-modeling]]></category>
            <dc:creator><![CDATA[Puy P]]></dc:creator>
            <pubDate>Sat, 18 Apr 2026 15:36:35 GMT</pubDate>
            <atom:updated>2026-04-18T15:36:35.070Z</atom:updated>
            <content:encoded><![CDATA[<p>Link Lab: <a href="https://www.skills.google/course_templates/627/labs/612995">https://www.skills.google/course_templates/627/labs/612995</a></p><p><strong>Challenge scenario</strong></p><p>You have started a new role as a Data Engineer for TaxiCab Inc. You are expected to import some historical data to a working BigQuery dataset, and build a basic model that predicts fares based on information available when a new ride starts. Leadership is interested in building an app and estimating for users how much a ride will cost. The source data will be provided in your project.</p><p>You are expected to have the skills and knowledge for these tasks, so don’t expect step-by-step guides to be provided.</p><p><strong>Task 1: Clean Your Training Data</strong></p><p>We need to copy data from the raw table into a clean training table. We will filter out anomalies like trips with zero distance, zero passengers, impossible fares, and coordinates that fall into the ocean (Null Island). We also combine tolls and fares to create the target fare_amount_617 column (The lab will be specific column name also table name and the conditions).</p><p>1. Open the BigQuery SQL Workspace.</p><p>2. Paste the following query and click <strong>Run. </strong>(Don’t forget to check the lab specific require for clean the data).</p><pre>CREATE OR REPLACE TABLE `taxirides.taxi_training_data_243` AS<br>SELECT<br>  pickup_datetime,<br>  pickup_longitude AS pickuplon,<br>  pickup_latitude AS pickuplat,<br>  dropoff_longitude AS dropofflon,<br>  dropoff_latitude AS dropofflat,<br>  passenger_count AS passengers,<br>  (tolls_amount + fare_amount) AS fare_amount_617<br>FROM<br>  `taxirides.historical_taxi_rides_raw`<br>WHERE<br>  RAND() &lt; 0.001<br>  AND trip_distance &gt; 0 <br>  AND fare_amount &lt; 3<br>  AND passenger_count &gt; 0<br>  AND pickup_longitude &gt; -78 AND pickup_longitude &lt; -70<br>  AND dropoff_longitude &gt; -78 AND dropoff_longitude &lt; -70<br>  AND pickup_latitude &gt; 37 AND pickup_latitude &lt; 45<br>  AND dropoff_latitude &gt; 37 AND dropoff_latitude &lt; 45</pre><p><strong>Task 2: Create a BigQuery ML Model</strong></p><p>Now, we will train a Linear Regression model on clean data. Notice how we use a WITH clause to engineer the euclidean distance feature on the fly before feeding it into the model. With also need to use TRANSFORM to reduce RMSE. Don&#39;t forgot to change the fare_model to follow the lab specific.</p><p>1. Clear your SQL Editor.</p><p>2. Paste the following query and click <strong>Run</strong>.</p><pre>CREATE OR REPLACE MODEL `taxirides.fare_model_251`<br>TRANSFORM(<br>  fare_amount_617,<br>  CAST(EXTRACT(DAYOFWEEK FROM pickup_datetime) AS STRING) AS dayofweek,<br>  CAST(EXTRACT(HOUR FROM pickup_datetime) AS STRING) AS hourofday,<br>  ST_Distance(ST_GeogPoint(pickuplon, pickuplat), ST_GeogPoint(dropofflon, dropofflat)) AS euclidean<br>)<br>OPTIONS(<br>  model_type=&#39;linear_reg&#39;,<br>  input_label_cols=[&#39;fare_amount_617&#39;]<br>) AS<br>SELECT * FROM `taxirides.taxi_training_data_243`;</pre><p>To check the RMSE, we can use this query to verify. (Don’t forgot to change fare_model and taxi_training_data name)</p><pre>SELECT<br>  SQRT(mean_squared_error) AS rmse<br>FROM<br>  ML.EVALUATE(MODEL `taxirides.fare_model_946`,<br>    (SELECT * FROM `taxirides.taxi_training_data_243`)<br>  );</pre><p><strong>Task 3: Perform Batch Predictions on New Data</strong></p><p>Finally, leadership wants we to predict fares for a new batch of 2015 data. We will use the ML.PREDICT function. <strong>Crucially</strong>, we must apply the exact same euclidean distance calculation to this prediction data so our model knows how to read it.</p><p>1. Clear your SQL Editor.</p><p>2. Paste the following query and click <strong>Run</strong>. (Don’t forgot to change the fare_model to match the lab require.)</p><pre>CREATE OR REPLACE TABLE `taxirides.2015_fare_amount_predictions` AS<br>SELECT * FROM ML.PREDICT(MODEL `taxirides.fare_model_946`, <br>  (SELECT * FROM `taxirides.report_prediction_data`)<br>);</pre><p>Congratulations! Complete the lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XhjlZ9EdgaDQBGDc" /></figure><p>My Blog Content: <a href="https://www.piscessera.com/blog/engineer-data-for-predictive-modeling-with-bigquery-ml-challenge-lab">https://www.piscessera.com/blog/engineer-data-for-predictive-modeling-with-bigquery-ml-challenge-lab</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=031c5f5aa7aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implement Multimodal Vector Search with BigQuery: Challenge Lab]]></title>
            <link>https://puy-prachya.medium.com/implement-multimodal-vector-search-with-bigquery-challenge-lab-85d6e59dfa6e?source=rss-d8a24ce06f2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/85d6e59dfa6e</guid>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[vector-search]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[googleskills]]></category>
            <dc:creator><![CDATA[Puy P]]></dc:creator>
            <pubDate>Mon, 13 Apr 2026 17:28:46 GMT</pubDate>
            <atom:updated>2026-04-13T17:28:46.107Z</atom:updated>
            <content:encoded><![CDATA[<p>Lab Link: <a href="https://www.skills.google/course_templates/1232/labs/598657">https://www.skills.google/course_templates/1232/labs/598657</a></p><p><strong>Challenge Scenario</strong></p><p>You are a data scientist at Cymbal, an online retail store. You want to build a pipeline to constantly search for similar products on the market to inform a marketing comparison study. You have a few challenges:</p><ul><li>How to handle multimodal data: The data you have collected is multimodal including text, image, and video, including some files in Cloud Storage.</li><li>How to perform a semantic similarity search instead of a keyword search: You want to find similar products across multiple dimensions (e.g., image, description, and specific features), where keyword search may not be effective.</li><li>How to use BigQuery to do it: Since most of your data is already in BigQuery, using the same tool could minimize the learning curve.</li></ul><p>To address these challenges, you decide to implement multimodal vector search with BigQuery.</p><p><strong>Task 1: Set up the Environment &amp; Connection</strong></p><p>0. Go to BigQuery, then Click on <strong>Connections.</strong></p><p>1. <strong>Create Connection:</strong> In the BigQuery, click <strong>Create Connection</strong>.</p><p>* <strong>Connection type:</strong> Vertex AI remote models, remote functions and BigLake (Cloud Resource).</p><p>* <strong>Connection ID:</strong> vector_conn (or as specified in the lab).</p><p>* <strong>Location Type:</strong> us-west1 (or as specified in the lab).</p><p>2. <strong>Grant Permissions:</strong> Once created, click on the connection ID. Copy the <strong>Service Account ID</strong> (looks like an email).</p><p>3. <strong>IAM Policy:</strong> Go to <strong>IAM &amp; Admin &gt; IAM</strong>. Click <strong>Grant Access</strong>.</p><p>* <strong>New principals:</strong> Paste the Service Account ID.</p><p>* <strong>Role:</strong> BigQuery Data Owner.</p><p>* <strong>Role:</strong> Vertex AI User.</p><p>* <strong>Role:</strong> Storage Object Viewer.</p><p><strong>Task 2: Create the Object Table</strong></p><p>Create an object table that allows BigQuery to treat files in a GCS buckets as rows in a table. Lab will be provided the query to use. Then replace [] value in the query. Run the query in BigQuery SQL Editor.</p><pre>Create or replace external table `[PROJECT_ID].[DATASET_NAME].[OBJECT_TABLE_NAME]`<br>with connection `[PROJECT_ID].[CONNECTION_REGION].[CONNECTION_NAME]`<br>options<br>(<br>object_metadata=&#39;SIMPLE&#39;,<br>uris=[&#39;gs://[PROJECT_ID]/*&#39;]<br>)</pre><p><strong>Task 3: Generate Embeddings</strong></p><p>Part 1: Connect to the multimodal embeddings model</p><p>1. Open the BigQuery SQL Editor.</p><p>2. Paste the following query.</p><p>3. Replace [] to the lab specific.</p><pre>Create or replace model<br>`[PROJECT_ID].[DATASET_NAME].[MODEL_NAME]`<br>remote with connection `[PROJECT_ID].[CONNECTION_REGION].[CONNECTION_NAME]`<br>options(<br>   endpoint = `[ENDPOINT_MODEL_NAME]`<br>);</pre><p>Example.</p><pre>Create or replace model<br>`[PROJECT_ID].gcc_bqml_dataset.gcc_embedding`<br>remote with connection `[PROJECT_ID].us-west1.vector_conn`<br>options(<br>    endpoint = &#39;multimodalembedding@001&#39;<br>);</pre><p>4. Click Run.</p><p>Part 2: Generate embeddings</p><p>1. Clear BigQuery SQL Editor.</p><p>2. Paste the following query.</p><p>3. Replace [] to the lab specific.</p><pre>Create or replace table `[PROJECT_ID].[DATASET_NAME].[EMBEDDINGS_TABLE_NAME]`<br>as select *, REGEXP_EXTRACT(uri, r&#39;[^/]+$&#39;) as product_name<br>from [EMBEDDINGS_FUNCTION]<br>(<br>MODEL `[PROJECT_ID].[DATASET_NAME].[MODEL_NAME]`,<br>TABLE `[PROJECT_ID].[DATASET_NAME].[OBJECT_TABLE_NAME]`<br>)</pre><p>Example.</p><pre>Create or replace table `[PROJECT_ID].gcc_bqml_dataset.gcc_retail_store_embeddings`<br>as select *, REGEXP_EXTRACT(uri, r&#39;[^/]+$&#39;) as product_name<br>from ML.GENERATE_EMBEDDING<br>(<br>MODEL `[PROJECT_ID].gcc_bqml_dataset.gcc_embedding`,<br>TABLE `[PROJECT_ID].gcc_bqml_dataset.gcc_image_object_table`<br>)</pre><p>4. Click Run.</p><p><strong>Task 4. Run a vector search</strong></p><p>1. Clear BigQuery SQL Editor.</p><p>2. Paste the following query.</p><p>3. Replace [] to the lab specific.</p><pre>Create or replace table `[PROJECT_ID].[DATASET_NAME].[SEARCH_RESULTS_TABLE]` AS<br>select base.uri,<br>base.product_name,<br>base.content_type,<br>distance<br> from<br>[VECTOR_SEARCH_FUNCTION](table [DATASET_NAME].[EMBEDDINGS_TABLE_NAME],&#39;ml_generate_embedding_result&#39;,<br>(<br>SELECT ml_generate_embedding_result as embedding_col<br>FROM<br> [EMBEDDINGS_FUNCTION]<br> (<br>   MODEL `[DATASET_NAME].[MODEL_NAME]`,<br>   (select &#39;Men Sweaters&#39; as content),<br>   STRUCT(TRUE AS flatten_json_output)<br> )<br>),<br>  [STATEMENT_TO_SELECT_TOP_2_RESULTS],<br>  distance_type =&gt; &#39;COSINE&#39;<br>);</pre><p>Example.</p><pre>Create or replace table `[PROJECT_ID].gcc_bqml_dataset.gcc_vector_search_table` AS<br>select base.uri,<br>base.product_name,<br>base.content_type,<br>distance<br> from<br>VECTOR_SEARCH(table gcc_bqml_dataset.gcc_retail_store_embeddings,&#39;ml_generate_embedding_result&#39;,<br>(<br>SELECT ml_generate_embedding_result as embedding_col<br>FROM<br> ML.GENERATE_EMBEDDING<br> (<br>   MODEL `gcc_bqml_dataset.gcc_embedding`,<br>   (select &#39;Men Sweaters&#39; as content),<br>   STRUCT(TRUE AS flatten_json_output)<br> )<br>),<br>  top_k =&gt; 2,<br>  distance_type =&gt; &#39;COSINE&#39;<br>);</pre><p>Done the lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*8r7tzso10CIjvDXW" /></figure><p>My Blog Content: <a href="https://www.piscessera.com/blog/implement-multimodal-vector-search-with-bigquery-challenge-lab">https://www.piscessera.com/blog/implement-multimodal-vector-search-with-bigquery-challenge-lab</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85d6e59dfa6e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Manage Kubernetes in Google Cloud: Challenge Lab]]></title>
            <link>https://puy-prachya.medium.com/manage-kubernetes-in-google-cloud-challenge-lab-a8dffcae32e4?source=rss-d8a24ce06f2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8dffcae32e4</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[k8s]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[googleskills]]></category>
            <dc:creator><![CDATA[Puy P]]></dc:creator>
            <pubDate>Sat, 11 Apr 2026 09:16:19 GMT</pubDate>
            <atom:updated>2026-04-11T09:16:19.876Z</atom:updated>
            <content:encoded><![CDATA[<p>Lab Link: <a href="https://www.skills.google/course_templates/783/labs/612117">https://www.skills.google/course_templates/783/labs/612117</a></p><p><strong>Challenge scenario</strong></p><p>You were onboarded at Cymbal Shops just a few months ago. You have spent a lot of time working with containers in Docker and Artifact Registry and have learned the ropes of managing new and existing deployments on GKE. You’ve had practice updating manifests as well as scaling, monitoring, and debugging applications running on your clusters.</p><p>Your team would like you to start managing their Kubernetes deployments to ensure smooth rollouts and application updates to their new e-commerce website. Before you switch to this new role, the development team would like you to demonstrate your new skills. As part of this demonstration, they have a list of tasks they would like to see you do in an allotted period of time in a sandbox environment.</p><p><strong>Preparation</strong></p><p>1. Open <strong>Cloud Shell</strong> .</p><p>2. Copy the block below into a text editor (like Notepad), replace the bracketed [VALUES] with the specific lab details, and then paste it into Cloud Shell. (The value will fine at the yellow highlight in the lab instruction.)</p><pre># The value will fine at the yellow highlight in the lab instruction.<br>export CLUSTER_NAME=&quot;[YOUR_CLUSTER_NAME]&quot;<br>export ZONE=&quot;[YOUR_ZONE]&quot;<br>export NAMESPACE=&quot;[YOUR_NAMESPACE]&quot;<br>export INTERVAL=&quot;[YOUR_INTERVAL]&quot;       # E.g., 15s or 30s<br>export REPO_NAME=&quot;[YOUR_REPO_NAME]&quot;<br>export SERVICE_NAME=&quot;[YOUR_SERVICE_NAME]&quot;</pre><pre># These will set automatically<br>export PROJECT_ID=$(gcloud config get-value project)<br>export REGION=&quot;${ZONE%-*}&quot;<br>gcloud config set compute/zone $ZONE</pre><p><strong>Task 1: Create a GKE Cluster</strong></p><p>We will build a cluster with specific sizing, release channels, and autoscaling configured.</p><p>1. Run the following command to create the cluster. <em>(This will take 5–8 minutes to complete)</em></p><pre>gcloud container clusters create $CLUSTER_NAME \<br>   --zone=$ZONE \<br>   --release-channel=regular \<br>   --cluster-version=latest \<br>   --enable-autoscaling \<br>   --num-nodes=3 \<br>   --min-nodes=2 \<br>   --max-nodes=6 \<br>   --no-enable-ip-alias</pre><p>2. Once the cluster is built, authenticate kubectl to it.</p><pre>gcloud container clusters get-credentials $CLUSTER_NAME --zone=$ZONE</pre><p><strong>Task 2: Enable Managed Prometheus</strong></p><p>We need to enable managed metrics, create the designated namespace, and deploy a Prometheus sample application with a Pod Monitoring resource.</p><p>1. Enable Managed Prometheus on the cluster.</p><pre>gcloud container clusters update $CLUSTER_NAME --zone=$ZONE --enable-managed-prometheus</pre><p>2. Create the required Kubernetes namespace.</p><pre>kubectl create ns $NAMESPACE</pre><p>3. Create and apply the prometheus-app deployment and the pod-monitoring resource. We will build the files directly in Cloud Shell.</p><pre>cat &lt;&lt;EOF &gt; prometheus-app.yaml<br>   apiVersion: apps/v1<br>   kind: Deployment<br>   metadata:<br>     name: prometheus-test<br>     labels:<br>       app: prometheus-test<br>   spec:<br>     selector:<br>       matchLabels:<br>         app: prometheus-test<br>     replicas: 3<br>     template:<br>       metadata:<br>         labels:<br>           app: prometheus-test<br>       spec:<br>         nodeSelector:<br>           kubernetes.io/os: linux<br>           kubernetes.io/arch: amd64<br>         containers:<br>         - image: nilebox/prometheus-example-app:latest<br>           name: prometheus-test<br>           ports:<br>           - name: metrics<br>             containerPort: 1234<br>           command:<br>           - &quot;/main&quot;<br>           - &quot;--process-metrics&quot;<br>           - &quot;--go-metrics&quot;<br>EOF #Type to end of file</pre><pre>kubectl -n $NAMESPACE apply -f prometheus-app.yaml</pre><p>4. Now apply the Pod Monitoring definition.</p><pre>cat &lt;&lt;EOF &gt; pod-monitoring.yaml<br>   apiVersion: monitoring.googleapis.com/v1alpha1<br>   kind: PodMonitoring<br>   metadata:<br>     name: prometheus-test<br>     labels:<br>       app.kubernetes.io/name: prometheus-test<br>   spec:<br>     selector:<br>       matchLabels:<br>         app: prometheus-test<br>     endpoints:<br>     - port: metrics<br>       interval: $INTERVAL<br>EOF #Type to end of file</pre><pre>kubectl -n $NAMESPACE apply -f pod-monitoring.yaml</pre><p><strong>Task 3: Deploy an Application (with errors)</strong></p><p>The lab provides a set of files in a Cloud Storage bucket containing an intentional error that will need to deploy.</p><p>1. Copy the files from the lab’s storage bucket and navigate into the folder.</p><pre>gsutil cp -r gs://spls/gsp510/hello-app/ .<br>cd ~/hello-app</pre><p>2. Apply the broken manifest.</p><pre>kubectl -n $NAMESPACE apply -f manifests/helloweb-deployment.yaml</pre><p>Note: If We run kubectl get pods -n $NAMESPACE, We will see them failing with errors. This is intentional for the next task!</p><p><strong>Task 4: Create Logs-Based Metrics and Alerting</strong></p><p>We must find the error pattern in Cloud Logging and create an alert based on it.</p><p>1. In the Cloud Console search bar, type <strong>Logging</strong> and click <strong>Logs Explorer</strong>.</p><p>2. Click the <strong>Create Metric</strong> button (under <strong>Actions </strong>menu).</p><p>3. Configure the metric parameters:</p><p>* <strong>Metric Type:</strong> Counter</p><p>* <strong>Log metric name:</strong> pod-image-errors (or whatever specific metric name the lab instructions ask for).</p><p>4. Under the <strong>Filter selection</strong> area, paste the following query to catch the Kubernetes warnings.</p><pre>resource.type=&quot;k8s_pod&quot; severity=WARNING</pre><p>5. Click <strong>Create Metric</strong>.</p><p>6. Now, go to <strong>Monitoring</strong> &gt; <strong>Alerting</strong> in the left menu.</p><p>7. Click <strong>+ Create Policy</strong>.</p><p>8. Select the metric you just made. (Search for pod-image-errors (Don&#39;t forgot to uncheck active to find the metric name), it will be under logging/user/pod-image-errors). Click Apply.</p><p>9. Under Transform data, set Rolling window to 10 min, Rolling window function to count, Across time series to sum (Check these values that match the lab specific).</p><p>10. Under Condition (Configure alert trigger), set <strong>Threshold position</strong> to Above threshold and <strong>Threshold value</strong> to 0. Click Next.</p><p>11. Disable notification channel.</p><p>12. Give the alert policy the exact name required by the lab (e.g., Pod Error Alert) and click <strong>Create Policy</strong>.</p><p><strong>Task 5: Update and Redeploy</strong></p><p>Now we must fix the broken deployment by fixing the image name in the YAML file.</p><p>1. Back in Cloud Shell, delete the broken deployment first.</p><pre>kubectl delete deployments helloweb -n $NAMESPACE</pre><p>2. Open the deployment file in the text editor.</p><pre>nano manifests/helloweb-deployment.yaml</pre><p>3. Locate the image: line. It currently has a typo. Fix it so it points to the correct sample image (the lab will state what it should be, typically us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0).</p><p>4. Save and exit Ctrl+O, Enter, Ctrl+X).</p><p>5. Redeploy the fixed application.</p><pre>kubectl -n $NAMESPACE apply -f manifests/helloweb-deployment.yaml</pre><p><strong>Task 6: Containerize and Deploy New Code</strong></p><p>Finally, We must build a Version 2 v2) image, push it to your Artifact Registry, do a rolling update on the cluster, and expose it via a LoadBalancer.</p><p>1. Authenticate Docker to your region’s Artifact Registry.</p><pre>gcloud auth configure-docker $REGION-docker.pkg.dev --quiet</pre><p>2. Build the new Docker image directly from the ~/hello-app folder.</p><pre>docker build -t $REGION-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/hello-app:v2 .</pre><p>3. Push the newly built image to the pre-created Artifact Registry.</p><pre>docker push $REGION-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/hello-app:v2</pre><p>4. Perform a rolling update on your running deployment to swap it to v2.</p><pre>kubectl set image deployment/helloweb -n $NAMESPACE hello-app=$REGION-docker.pkg.dev/$PROJECT_ID/$REPO_NAME/hello-app:v2</pre><p>5. Finally, expose the deployment using a LoadBalancer service to make it publicly accessible.</p><pre>kubectl expose deployment helloweb \<br>   -n $NAMESPACE \<br>   --name=$SERVICE_NAME \<br>   --type=LoadBalancer \<br>   --target-port 8080 \<br>   --port 8080</pre><p>Once we run this final command, Kubernetes will provision an External IP. We can monitor its creation by running kubectl get services -n $NAMESPACE.</p><p>Congratulations! Complete the lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ELWfj2NMLWy-_vbg.png" /></figure><p>My Blog Link: <a href="https://www.piscessera.com/blog/manage-kubernetes-in-google-cloud-challenge-lab">https://www.piscessera.com/blog/manage-kubernetes-in-google-cloud-challenge-lab</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8dffcae32e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Develop Serverless Applications on Cloud Run: Challenge Lab]]></title>
            <link>https://puy-prachya.medium.com/develop-serverless-applications-on-cloud-run-challenge-lab-521faee680c0?source=rss-d8a24ce06f2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/521faee680c0</guid>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[googleskills]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[gcp]]></category>
            <dc:creator><![CDATA[Puy P]]></dc:creator>
            <pubDate>Wed, 01 Apr 2026 06:00:55 GMT</pubDate>
            <atom:updated>2026-04-01T06:00:55.398Z</atom:updated>
            <content:encoded><![CDATA[<p>Lab Link: <a href="https://www.skills.google/course_templates/741/labs/592448">https://www.skills.google/course_templates/741/labs/592448</a></p><p><strong>Challenge scenario</strong></p><p>Pet Theory, a veterinary practice, is eager to adopt serverless architecture for modernizing their current systems.</p><p>In this challenge lab, as a member of the development team, your assignment is to transition a specific service to a serverless framework. It’s crucial to follow the detailed instructions given to accomplish this task successfully.</p><p><strong>Architecture overview</strong></p><p>For this project, Pet Theory has selected their current monolithic Billing application to undergo transformation into a serverless model.</p><p>Throughout this lab, your responsibility is to execute this architectural upgrade, ensuring a seamless transition to the serverless design.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/0*gR-M5by9cvD5kmi-" /></figure><p>Provision the lab environment</p><p>1. Open cloud shell.</p><p>2. Set preparation variables.</p><pre># 1. Set project ID as a variable<br>export PROJECT_ID=$(gcloud config get-value project)</pre><pre># 2. Set assigned region (REPLACE &quot;us-central1&quot; WITH THE REGION ASSIGNED TO YOU IN THE LAB INSTRUCTIONS)<br>export REGION=&quot;us-central1&quot; </pre><pre># 3. Configure gcloud defaults<br>gcloud config set run/region $REGION<br>gcloud config set run/platform managed</pre><pre># 4. Clone the lab repository<br>git clone <a href="https://github.com/rosera/pet-theory.git">https://github.com/rosera/pet-theory.git</a><br>cd pet-theory/lab07</pre><p><strong>Task 1. Enable a public service</strong></p><p>Build an image for “Billing Service” and deploy it, so that the service can access without authenticated.</p><p>1. Run the command. Check the billing service name in the lab and check on the deploy command that correct on deploy command public-billing-service.</p><pre># Navigate to the unit-api folder<br>cd ~/pet-theory/lab07/unit-api-billing<br><br># Build the image via Cloud Build<br>gcloud builds submit --tag gcr.io/$PROJECT_ID/billing-staging-api:0.1<br># Deploy it to Cloud Run as unauthenticated<br>gcloud run deploy public-billing-service \<br>  --image gcr.io/$PROJECT_ID/billing-staging-api:0.1 \<br>  --allow-unauthenticated</pre><p><strong>Task 2. Deploy a frontend service</strong></p><p>Build and deploy the frontend application. This web app will be public access.</p><p>1. Run the command. Also check the frontend service name on the lab and on the command frontend-staging-service.</p><pre># Navigate to the staging frontend folder<br>cd ~/pet-theory/lab07/staging-frontend-billing<br># Build the image<br>gcloud builds submit --tag gcr.io/$PROJECT_ID/frontend-staging:0.1<br># Deploy it to Cloud Run<br>gcloud run deploy frontend-staging-service \<br>  --image gcr.io/$PROJECT_ID/frontend-staging:0.1 \<br>  --allow-unauthenticated</pre><p><strong>Task 3. Deploy a private service</strong></p><p>The lab require to delete the old public billing service and redeploy with new version (0.2), this version also need an authenticated access.</p><p>1. Run the command. Also don’t forgot to check the private-billing-service name on the command that match the lab needed private-billing-service.</p><pre># Navigate to the staging api folder<br>cd ~/pet-theory/lab07/staging-api-billing<br># Delete the old public billing service<br>gcloud run services delete public-billing-service --quiet<br># Build the new 0.2 image<br>gcloud builds submit --tag gcr.io/$PROJECT_ID/billing-staging-api:0.2<br># Deploy it requiring authentication (--no-allow-unauthenticated)<br>gcloud run deploy private-billing-service \<br>  --image gcr.io/$PROJECT_ID/billing-staging-api:0.2 \<br>  --no-allow-unauthenticated</pre><p><strong>Task 4. Create a billing service account</strong></p><p>Create a Service Account that the new Billing Service can run.</p><p>1. Run the command. Check the service account on the command that match the lab needed billing-service-sa.</p><pre># Create the Billing Service Account<br>gcloud iam service-accounts create billing-service-sa --display-name &quot;Billing Service Account Cloud Run&quot;</pre><p><strong>Task 5. Deploy the billing service</strong></p><p>Deploy the production billing service using service account that created from previous task.</p><p>1. Run the command. Check the billing production service name and service account on the command that match the lab instruction (billing-prod-service and billing-service-sa).</p><pre># Navigate to the prod api folder<br>cd ~/pet-theory/lab07/prod-api-billing<br># Build the production image<br>gcloud builds submit --tag gcr.io/$PROJECT_ID/billing-prod-api:0.1<br># Deploy the production service attached to the new Service Account<br>gcloud run deploy billing-prod-service \<br>  --image gcr.io/$PROJECT_ID/billing-prod-api:0.1 \<br>  --no-allow-unauthenticated \<br>  --service-account=billing-service-sa@$PROJECT_ID.iam.gserviceaccount.com</pre><p><strong>Task 6. Frontend service account</strong></p><p>Create a service account for the frontend and grant the permission for accessing the secure backend billing service.</p><p>1. Run the command. Check the frontend service account frontend-service-sa, billing production service billing-prod-service, and frontend service account name frontend-service-sa on permission granted that match the lab needed.</p><pre># Create the Frontend Service Account<br>gcloud iam service-accounts create frontend-service-sa --display-name &quot;Frontend Service Account Cloud Run Invoker&quot;<br># Grant the Frontend SA permission to invoke the Billing Prod Service<br>gcloud run services add-iam-policy-binding billing-prod-service \<br>  --member=serviceAccount:frontend-service-sa@$PROJECT_ID.iam.gserviceaccount.com \<br>  --role=roles/run.invoker</pre><p><strong>Task 7. Redeploy the frontend service</strong></p><p>Deploy the production version of the frontend, and attach the new service account. It’ will be public (user can access the website), The web frontend app will be accessing private secure backend using service account.</p><p>1. Run the command. Again also don’t forgot to check the frontend service name (frontend-prod-service) and frontend service account name (frontend-service-sa) on the command that match the lab needed.</p><pre># Navigate to the prod frontend folder<br>cd ~/pet-theory/lab07/prod-frontend-billing<br># Build the production frontend image<br>gcloud builds submit --tag gcr.io/$PROJECT_ID/frontend-prod:0.1<br># Deploy the frontend service attached to its Service Account<br>gcloud run deploy frontend-prod-service \<br>  --image gcr.io/$PROJECT_ID/frontend-prod:0.1 \<br>  --allow-unauthenticated \<br>  --service-account=frontend-service-sa@$PROJECT_ID.iam.gserviceaccount.com</pre><p>Congratulations. Done the lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*mUkJYXkkv1T6HUkQGaX08w.png" /></figure><p>My original blog: <a href="https://www.piscessera.com/blog/develop-serverless-applications-on-cloud-run-challenge-lab">https://www.piscessera.com/blog/develop-serverless-applications-on-cloud-run-challenge-lab</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=521faee680c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mitigate Threats and Vulnerabilities with Security Command Center: Challenge Lab]]></title>
            <link>https://puy-prachya.medium.com/mitigate-threats-and-vulnerabilities-with-security-command-center-challenge-lab-666cf3168623?source=rss-d8a24ce06f2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/666cf3168623</guid>
            <category><![CDATA[google-cloud]]></category>
            <category><![CDATA[googleskills]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[gcp]]></category>
            <dc:creator><![CDATA[Puy P]]></dc:creator>
            <pubDate>Mon, 30 Mar 2026 10:32:16 GMT</pubDate>
            <atom:updated>2026-03-30T10:32:41.403Z</atom:updated>
            <content:encoded><![CDATA[<p>Let learn through the challenge lab.</p><p><strong>Challenge scenario</strong></p><p>Cymbal Bank is an American retail bank with over 2,000 branches in all 50 states. It offers comprehensive debit and credit services that are built on top of a robust payments platform. Cymbal Bank is a digitally transforming legacy financial services institution.</p><p>Cymbal Bank was founded in 1920 under the name Troxler. Cymbal Group acquired the company in 1975 after it had been investing heavily in Cymbal Group’s proprietary ATMs. As the bank grew into a national leader, they put strategic emphasis on modernizing the customer experience both in-person at their branches and digitally through an app they released in 2014. Cymbal Bank employs 42,000 people nationwide and, in 2019, reported $24 billion in revenue.</p><p>In this challenge, you are a cloud security engineer tasked with securing Cymbal Bank’s Google Cloud environment by leveraging Security Command Center’s features. You have performed these tasks in previous labs. Now, it’s your turn to demonstrate your proficiency with Security Command Center by implementing advanced threat detection and mitigation strategies, optimizing access controls, and ensuring compliance with industry regulations and best practices.</p><p><strong>Task 1. Configure the environment</strong></p><p>1. Go to Compute Engine &gt; VM instances.</p><p>2. Click on VM: cls-vm</p><p>3. Click Edit in detail page.</p><p>4. Go to Network interfaces section, and click the arrow to expand it.</p><p>5. At External IPv4 address, click and select Reserve static external IP address (It’s says “Ephemeral”).</p><p>6. Name the IP address exactly: static-ip.</p><p>7. Click Reserve, then click Save.</p><p>8. Copy this new static External IP (It’s will be used in Task 4.)</p><p><strong>Task 2. Create static mute rules for Cymbal Bank</strong></p><p>1. Open and active cloud shell.</p><p>2. Set your Project ID as variables.</p><pre>export PROJECT_ID=$(gcloud config get-value project)</pre><p>3. Run this 3 commands to generate the mute rules.</p><pre>gcloud scc muteconfigs create muting-flow-log-findings \<br>  --project=$PROJECT_ID \<br>  --filter=&#39;category=&quot;FLOW_LOGS_DISABLED&quot;&#39; \<br>  --description=&quot;Rule for muting VPC Flow Logs&quot;</pre><pre>gcloud scc muteconfigs create muting-audit-logging-findings \<br>  --project=$PROJECT_ID \<br>  --filter=&#39;category=&quot;AUDIT_LOGGING_DISABLED&quot;&#39; \<br>  --description=&quot;Rule for muting audit logs&quot;</pre><pre>gcloud scc muteconfigs create muting-admin-sa-findings \<br>  --project=$PROJECT_ID \<br>  --filter=&#39;category=&quot;ADMIN_SERVICE_ACCOUNT&quot;&#39; \<br>  --description=&quot;Admin service account&quot;</pre><p><strong>Task 3. Analyze and fix Cymbal Bank’s high vulnerability findings</strong></p><p>1. On search bar, type Firewall, and click (VPC Network &gt; Firewall).</p><p>2. Look for rules that allow public SSH and RDP. (It’s will be named like default-allow-rdp and default-allow-ssh)</p><p>3. Click on the default-allow-rdp rule and click Edit.</p><p>4. Find Soruce IPv4 ranges. Delete 0.0.0.0/0 and replace it with the IAP IP range: 35.235.240.0/20.</p><p>5. Click Save.</p><p>6. Click on the default-allow-ssh rule and click Edit.</p><p>7. Find Soruce IPv4 ranges. Delete 0.0.0.0/0 and replace it with the IAP IP range: 35.235.240.0/20.</p><p>8. Click Save.</p><p>Note: IP 35.235.240.0/20 is the secure standard for Google Cloud Firewall rules.</p><p><strong>Task 4. Identify application vulnerabilities with SCC’s security scanning features</strong></p><p>1. On search bar, type Web Security Scanner, and click (Security &gt; Web Security Scanner).</p><p>2. Click + New Scan</p><p>3. In the Starting URL field, type http://&lt;STATIC_IP&gt;:8080 (replace &lt;STATIC_IP&gt; with the External IP of cls-vm you copied in Task 1).</p><p>4. Leave all other settings as default, then click Save.</p><p>5. Click Run to start the scan.</p><p><strong>Task 5. Export Cymbal Bank Findings to Google Cloud Storage</strong></p><p>1. On search bar, type Cloud Storage.</p><p>2. Create new bucket. Bucket name, Location type, and Location are follow the lab detail in Task 5.</p><p>3. On search bar, type Findings, and click (Security &gt; Security Command Center &gt; Findings).</p><p>4. Verify the time range is still set to Last 180 days.</p><p>5. Click the Export button, then select Cloud Storage.</p><p>6. In Project dropdown, select Qwiklabs Project ID.</p><p>7. In the Export path field, click Browse, select the bucket that created on previous step (5.2), and add file name /findings.jsonl at the bottom, then click Export.</p><p>Congratulations. Complete the lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*jTX0d3W0SGu3pg5c.png" /></figure><p>Ref my original blog: <a href="https://www.piscessera.com/blog/mitigate-threats-and-vulnerabilities-with-security-command-center-challenge-lab">https://www.piscessera.com/blog/mitigate-threats-and-vulnerabilities-with-security-command-center-challenge-lab</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=666cf3168623" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implement Cloud Security Fundamentals on Google Cloud: Challenge Lab]]></title>
            <link>https://puy-prachya.medium.com/implement-cloud-security-fundamentals-on-google-cloud-challenge-lab-b79d02702204?source=rss-d8a24ce06f2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b79d02702204</guid>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[google-cloud]]></category>
            <category><![CDATA[cloud-security]]></category>
            <category><![CDATA[googleskills]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Puy P]]></dc:creator>
            <pubDate>Sat, 28 Mar 2026 05:19:06 GMT</pubDate>
            <atom:updated>2026-03-28T05:19:23.103Z</atom:updated>
            <content:encoded><![CDATA[<p>Link Lab: <a href="https://www.skills.google/course_templates/645/labs/593323">https://www.skills.google/course_templates/645/labs/593323</a></p><p>Let learn about implement cloud security foundamentals o ngoogle cloud via challenge lab.</p><p><strong>Challenge scenario</strong></p><p>You have started a new role as a junior member of the security team for the Orca team in Jooli Inc. Your team is responsible for ensuring the security of the Cloud infrastructure and services that the company’s applications depend on.</p><p><strong>Task 1. Create a custom security role</strong></p><p>0. Check the VM instances. We will find a orca-jumphost that the lab provisioned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S79M_-ZyYzmKxtpZ6oD8Vw.png" /></figure><p>1. Open Cloud Shell.</p><p>2. Set values from the lab.</p><pre>export CUSTOM_ROLE=&quot;[CUSTOM_ROLE_NAME]&quot;<br>export SA_NAME=&quot;[SERVICE_ACCOUNT_NAME]&quot;<br>export CLUSTER_NAME=&quot;[CLUSTER_NAME]&quot;<br>export ZONE=&quot;[ZONE]&quot;<br>export PROJECT_ID=$(gcloud config get-value project)</pre><p>3. Create a yaml file defining the permissions.</p><pre>cat &lt;&lt;EOF &gt; role-definition.yaml<br>title: &quot;$CUSTOM_ROLE&quot;<br>description: &quot;Custom role for challenge lab storage access&quot;<br>stage: &quot;ALPHA&quot;<br>includedPermissions:<br>- storage.buckets.get<br>- storage.objects.get<br>- storage.objects.list<br>- storage.objects.update<br>- storage.objects.create<br>EOF</pre><p>4. Create the custom role at the project level.</p><pre>gcloud iam roles create $CUSTOM_ROLE --project=$PROJECT_ID --file=role-definition.yaml</pre><p><strong>Task 2. Create a service account</strong></p><p>1. Create the account.</p><pre>gcloud iam service-accounts create $SA_NAME --display-name=&quot;Orca Private Cluster SA&quot;</pre><p>2. Export the full email address into variable.</p><pre>export SA_EMAIL=&quot;$SA_NAME@$PROJECT_ID.iam.gserviceaccount.com&quot;</pre><p><strong>Task 3. Bind a custom security role to a service account</strong></p><p>1. Apply the required role.</p><pre>gcloud projects add-iam-policy-binding $PROJECT_ID \<br>  --member=&quot;serviceAccount:$SA_EMAIL&quot; \<br>  --role=&quot;roles/monitoring.viewer&quot;</pre><pre>gcloud projects add-iam-policy-binding $PROJECT_ID \<br>  --member=&quot;serviceAccount:$SA_EMAIL&quot; \<br>  --role=&quot;roles/monitoring.metricWriter&quot;</pre><pre>gcloud projects add-iam-policy-binding $PROJECT_ID \<br>  --member=&quot;serviceAccount:$SA_EMAIL&quot; \<br>  --role=&quot;roles/logging.logWriter&quot;</pre><pre>gcloud projects add-iam-policy-binding $PROJECT_ID \<br>  --member=&quot;serviceAccount:$SA_EMAIL&quot; \<br>  --role=&quot;projects/$PROJECT_ID/roles/$CUSTOM_ROLE&quot;</pre><p><strong>Task 4. Create and configure a new Kubernetes Engine private cluster</strong></p><p>1. Run the following command to create cluster (It’s will takes 5–8 minutes to complete).</p><pre>gcloud container clusters create $CLUSTER_NAME \<br>  --zone=$ZONE \<br>  --num-nodes=1 \<br>  --master-ipv4-cidr=172.16.0.64/28 \<br>  --network=orca-build-vpc \<br>  --subnetwork=orca-build-subnet \<br>  --enable-master-authorized-networks \<br>  --master-authorized-networks=192.168.10.2/32 \<br>  --enable-ip-alias \<br>  --enable-private-nodes \<br>  --enable-private-endpoint \<br>  --service-account=$SA_EMAIL</pre><p>Cluster will be created. If create an incorrect cluster, can use the command before to temporary create a new cluster then delete the incorrect one (Because for passing the lab need to use correct cluster name and we will can’t create a same cluster name. Also we can’t remove the only one cluster, so that we need to create a temp cluster to delete the incorrect one.).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CYXvAOj5fRJJSKcExWVKYA.png" /></figure><p><strong>Task 5. Deploy an application to a private Kubernetes Engine cluster</strong></p><p>In Task 4. We disabled the public endpoint, Now we cannot connect to the cluster from standard cloud shell. We will use SSH into the orca-jumphost and deploy from the jumphost.</p><p>1. SSH into the jumphost.</p><pre>gcloud compute ssh orca-jumphost --zone=$ZONE</pre><p>2. Wait for accessing into jumphost, then authenticate to the cluster using internal IP.</p><pre>sudo apt-get install google-cloud-sdk-gke-gcloud-auth-plugin -y</pre><pre>gcloud container clusters get-credentials [CLUSTER_NAME] --zone [ZONE] --internal-ip</pre><p>3. Deploy a simple test application to cluster access.</p><pre>kubectl create deployment hello-server --image=gcr.io/google-samples/hello-app:1.0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*snxW-lGc5fFfj811ARg-bA.png" /></figure><p>Congratulations. Done the lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*XpHXQ6xnv3flGhMUXghyTw.png" /></figure><p>My Blog Link: <a href="https://www.piscessera.com/blog/implement-cloud-security-fundamentals-on-google-cloud-challenge-lab">https://www.piscessera.com/blog/implement-cloud-security-fundamentals-on-google-cloud-challenge-lab</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b79d02702204" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Monitor and Log with Google Cloud Observability: Challenge Lab]]></title>
            <link>https://puy-prachya.medium.com/monitor-and-log-with-google-cloud-observability-challenge-lab-da8ceac15e90?source=rss-d8a24ce06f2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/da8ceac15e90</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[googleskills]]></category>
            <category><![CDATA[google-cloud]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[Puy P]]></dc:creator>
            <pubDate>Fri, 27 Mar 2026 08:17:03 GMT</pubDate>
            <atom:updated>2026-03-27T08:17:03.320Z</atom:updated>
            <content:encoded><![CDATA[<p>Let learn monitor and log with google cloud observability with challenge lab.</p><p><strong>Challenge scenario</strong></p><p>In your new role as Junior Cloud Engineer for Jooli Inc., you’re expected to help manage the Cloud infrastructure components and support the video operations team. Common tasks include monitoring resource utilization, analyzing logs, configuring alerts, and reporting on any issues related to Jooli Inc.’s online services.</p><p><strong>Task 1. Configure Cloud Monitoring</strong></p><p>1. Go to Compute Engine &gt; VM Instances</p><p>2. Click on the name of VM that lab provisioned: video-queue-monitor.</p><p>3. On the VM details, copy Instance ID, Zone, and Project ID (From Qwiklabs Google Cloud Project ID).</p><p>4. In search bar, type Monitoring.</p><p>5. Wait a few moments. For visiting this page initializes. This will enable Cloud Monitoring API for the project.</p><p><strong>Task 2. Configure a Compute Instance to generate Custom Cloud Monitoring metrics</strong></p><p>1. Go back to Compute Engine &gt; VM instances.</p><p>2. Click on the video-queue-monitor VM.</p><p>3. Click the Edit button.</p><p>4. Scroll down to the Customer metadata section. Then modify the values inside the script by replace the dummy text.</p><p>5. Click Save.</p><p>6. Go back to VM list page (Main VM instances page).</p><p>7. Click Stop and wait a minute for the VM to stop. Then click Start / Resume. This will reboots the VM and runs the modified startup script. That allow custom metrics to start generating.</p><p><strong>Task 3. Create a custom metric using Cloud Operations logging events</strong></p><p>1. In search bar, type Logs Explorers.</p><p>2. Copy and paste this query into the query editor.</p><pre>textPayload=~&quot;file_format\: ([4,8]K).*&quot;</pre><p>3. Click Run Query. (For viewing the result)</p><p>4. Click the Create Metric button on Action button.</p><p>5. Configure the metric:</p><ul><li>Metric Type: Counter</li><li>Log metric name: [follow the lab custom metric name] eg., like big_video_upload_rate, huge_video_upload_rate</li></ul><p>6. Click Create Metric.</p><p><strong>Task 4. Add custom metrics to the Media Dashboard in Cloud Operations Monitoring</strong></p><p>1. In search bar, Type Dashboards.</p><p>2. Click on Create Custom Dashboard.</p><p>3. Add the first Chart (Title: Video Queue Size)</p><ul><li>Click + Add Widget, then select Line Chart.</li><li>In the Metric search box, type custom.googleapis.com/opencensus/my.videoservice.org/measure/input_queue_size If the metric doesn&#39;t appear, uncheck the &quot;Active&quot; toggle or wait around 3-5 minutes for the newly restarted VM to send the first metric.</li><li>Select and click Apply.</li></ul><p>4. Add the second Chart (Title: High Resolution Video Upload Rate)</p><ul><li>Click + Add Widget, then select Line Chart.</li><li>In the Metric search box, type the metric name from Task 3. that the lab setting eg., like huge_video_upload_rate It&#39;s under VM Instance &gt; Logs-based metrics. If the metric doesn&#39;t appear, uncheck the &quot;Active&quot; toggle or wait around 3-5 minutes for the metric appear.</li></ul><p><strong>Task 5. Create a Cloud Operations alert based on the rate of high resolution video file uploads</strong></p><p>1. In search bar, type Alerting</p><p>2. Click + Create Policy</p><p>3. Click Select a metric:</p><ul><li>Search for metric name from Task 3. and Task 4. like huge_video_upload_rate (It&#39;s the name that the lab setting.)</li><li>Navigate to VM Instance &gt; Logs-based metrics &gt; huge_video_upload_rate (Or the lab setting).</li><li>Click Apply</li></ul><p>4. Configure the Condition:</p><ul><li>Condition type: Threshold</li><li>Threshold position: Above threshold</li><li>Threshold value: (From the lab setting, eg., 3 or other)</li><li>Click Next.</li></ul><p>5. Configure Notifications</p><ul><li>Click the Notification Channels dropdown, select Manage Notification Channels (Open new tab)</li><li>Add email under “Email”, set personal email and naming like “Email Address” or other name.</li><li>Select Email under dropdown from Notification Channels dropdown. Click Next.</li></ul><p>6. Give the alert policy a name, like “High resolution video file uploads”, and click Create Policy.</p><p>Congratulations. Complete the lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*pv9KRW6rNvbNFxAOSEYOAw.png" /></figure><p>Ref with some screenshot: <a href="https://www.piscessera.com/blog/monitoring-and-log-with-google-cloud-observability-challenge-lab">https://www.piscessera.com/blog/monitoring-and-log-with-google-cloud-observability-challenge-lab</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da8ceac15e90" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Monitoring in Google Cloud: Challenge Lab]]></title>
            <link>https://puy-prachya.medium.com/monitoring-in-google-cloud-challenge-lab-c23a250c3f08?source=rss-d8a24ce06f2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c23a250c3f08</guid>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[googleskills]]></category>
            <category><![CDATA[google-cloud]]></category>
            <dc:creator><![CDATA[Puy P]]></dc:creator>
            <pubDate>Thu, 26 Mar 2026 17:10:29 GMT</pubDate>
            <atom:updated>2026-03-26T17:10:29.728Z</atom:updated>
            <content:encoded><![CDATA[<p>Let learn about monitoring in google cloud via challenge lab.</p><p><strong>Challenge scenario</strong></p><p>As a junior cloud engineer, you are part of a team of people assigned to manage Google Cloud resources in your organization. One of your job requirements in this role is to use the Cloud Logging and Cloud Monitoring services to monitor Apache Web Server activities installed on a virtual machine (VM) instance.</p><p>Let start the lab.</p><p><strong>Task 1. Install the Cloud Logging and Monitoring agents</strong></p><p>1. Go to Compute Engine &gt; VM Instances.</p><p>2. Click SSH button on the provisioned VM.</p><p>3. Install the logging agent.</p><pre>curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh sudo bash add-logging-agent-repo.sh --also-install</pre><p>4. Install the monitoring agent.</p><pre>curl -sSO https://dl.google.com/cloudagents/add-monitoring-agent-repo.sh sudo bash add-monitoring-agent-repo.sh --also-install</pre><p>5. Enable the Apache Web Server monitoring plugin.</p><pre>cd /etc/stackdriver/collectd.d/</pre><pre>sudo curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/apache.conf</pre><pre>sudo service stackdriver-agent restart</pre><p><strong>Task 2. Add an uptime check for Apache Web Server on the VM</strong></p><p>1. Go to search bar, “Uptime checks” Under Monitoring</p><p>2. Click + Create Uptime Check button</p><p>3. Config with these settings:</p><ul><li>Protocol: HTTP</li><li>Resource Type: URL</li><li>Hostname: (External IP of VM from Task 1.)</li><li>Path: /</li></ul><p>4. Click continue.</p><p>5. Click Test for validation, Once it returns a “200 OK”, click Create.</p><p><strong>Task 3. Add an alert policy for Apache Web Server</strong></p><p>1. Generate Test Traffic by switch to VM’s SSH terminal window. and run this command. It will generate network traffic for alert policy can trigger.</p><pre>timeout 120 bash -c -- &#39;while true; do curl localhost | grep -oP &quot;.*&quot;; sleep .1s;done&#39;</pre><p>2. Go back to Cloud Console, go to search bar, “Alerting” under Monitoring</p><p>3. Click + Create Policy button</p><p>4. Select metric dropdown:</p><ul><li>Uncheck the “Active” toggle.</li><li>Type “traffic” in search bar</li><li>Nagivate to VM Instance &gt; Apache &gt; Network traffic</li><li>Click Apply</li></ul><p>5. Configure the Condition</p><ul><li>Condition Type: Threshold</li><li>Threshold position: Above threshold</li><li>Threshold value: 3072 (3 KiB/s in bytes)</li><li>Click Next.</li></ul><p>6. Configure Notifications:</p><ul><li>Click on drop-down for Notification Channels and select Manage Notification Channels</li><li>Scroll down to Email and click Add New</li><li>Enter personal email or alternative email for receive alert email, give a display name like “Email Address” or related, and click Save.</li><li>Go back to Alerting tab, select a newly added email, and click OK.</li></ul><p>7. Name the alert policy like “Apache Traffic Alert” or anything, and click Create Policy.</p><p><strong>Task 4. Create a dashboard and charts for Apache Web Server on the VM</strong></p><p>1. Go to search bar, “Dashboard” under Monitoring.</p><p>2. Click + Create Dashboard.</p><p>3. Add first chart (Title: CPU Load):</p><ul><li>Click + Add Widget and select Line Chart.</li><li>In the Metric search box, type CPU load (1m).</li><li>Select the metric under VM Instance &gt; CPU and click Apply.</li></ul><p>4. Add second chart (Title: Apache Requests):</p><ul><li>Click + Add Widget and select Line Chart.</li><li>Uncheck “Active” toggle, In Metric search box, type Requests.</li><li>Select the metric under VM Instance &gt; Apache &gt; Requests and click Apply</li></ul><p><strong>Task 5. Create a log-based metric</strong></p><ol><li>In search bar, “Logs Explorer”.</li><li>Select filters:</li></ol><ul><li>Resource Type: VM Instance</li><li>Log Metric: apache-access</li><li>Add textPayload:”200&quot; on query editor</li><li>Click Actions button on right area.</li><li>Click Create metric</li><li>Metric Type: Counter</li><li>Log metric name: apache-access</li></ul><p>Congratulations. Complete the lab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*iuQYOY2t-mAxo98FQM9RIg.png" /></figure><p>Ref: <a href="https://www.piscessera.com/blog/monitoring-in-google-cloud-challenge-lab">https://www.piscessera.com/blog/monitoring-in-google-cloud-challenge-lab</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c23a250c3f08" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>