Prepare and test your skills
Prepare and test your skills
Infrastructure as Code (IaC) validation and compliance is the process of checking version-controlled infrastructure templates for errors and policy violations before resources are created. Infrastructure as Code (IaC) defines cloud resources in code instead of manual clicks, so validation must happen before provisioning. This early checking prevents misconfigurations from reaching production where they are harder and more expensive to fix.
Validating templates before provisioning means running proposed changes through increasingly strict automated checks, with deployment allowed only after all checks pass. The template flows from the developer to automated validation and then to the cloud control plane for provisioning, and only validated code is allowed to create or change infrastructure. This order creates a trust boundary between proposed change and production, where nothing crosses into production without proof that it meets organizational standards (opens in a new tab).
The three pre-deployment methods catch different classes of problems:
| Method | What it checks | When it runs |
|---|---|---|
| Linting | Syntax, formatting, and basic configuration errors in the IaC template | First, as soon as the template is written or committed |
| Policy-as-code enforcement | Allowed regions, encryption, identity controls, and other security rules | Second, by evaluating the template against codified policies |
| Pre-deployment simulation | Which resources would be created, modified, or deleted | Third, by previewing the plan before provisioning |
Exam tip: Linting checks whether the template is written correctly, while policy-as-code checks whether the template is allowed by security and compliance rules.
Policy-as-code enforcement is the automatic approval or denial of an IaC template based on codified security policies. Security policies define the security objectives for information resources, and tools such as Sentinel or Forseti compare the desired configuration in the template to those objectives. Because the policy makes the decision, enforcement is consistent across teams and environments.
When a template violates a policy, the deployment pipeline blocks provisioning and returns the template to the developer for correction. When a template passes, the pipeline permits the control plane to provision the described resources. This decision point directly implements configuration management (opens in a new tab) for IaC, since the approved template becomes the source of truth.
Confirming compliance after deployment means verifying that running resources still match the validated IaC definitions over time. Deployed infrastructure can drift when someone makes a manual change or when a new weakness is discovered, so post-deployment validation depends on systems that observe the production environment. The lifecycle moves in order from proposed to validated to deployed to monitored.
Post-deployment validation relies on four connected controls:
Performance, load, and resiliency testing proves that applications on Google Cloud can handle expected demand, peak stress, and failures without losing reliability. Performance and load testing measures scalability and resource efficiency under traffic, while resiliency testing validates high availability (opens in a new tab) and failover by deliberately causing failures. Together the tests confirm recovery time objective (RTO), recovery point objective (RPO), and data integrity before users are affected.
Performance and load testing validates that cloud applications maintain speed and reliability under peak loads. Cloud Load Balancing distributes simulated real-world traffic to test targets, while external load-testing services generate realistic request patterns to measure response time and resource use. Load testing simulates normal and peak traffic to check behavior, while stress testing pushes the system to its limits to find bottlenecks.
Regular testing gives architects data to adjust resource allocation, tune configuration, and plan capacity. Test results show resource use under different loads, which supports accurate capacity planning and avoids problems from resource constraints. Integrating automated tests into CI/CD pipelines validates code and infrastructure changes before production and reduces errors and regressions.
Capacity planning for scalability estimates the Google Cloud resources needed to handle forecast load with adequate redundancy. Forecasting considers user count, request rate, historical trends, seasonal variations, event spikes, and growth from business changes such as expansion to new geographies. Estimation then translates that forecast into concrete resources, such as the size of Compute Engine managed instance groups (MIGs), virtual machine (VM) machine type, and the number, type, and size of persistent disks.
Benchmarking measures resource efficiency, which is the relationship between application load and resources such as CPU and memory that the application consumes. Teams run load tests for normal and peak conditions and repeat benchmarking at regular intervals, because efficiency can deteriorate under very high load and can change over time. To ensure capacity is available, teams manage quotas, reserve compute, and monitor utilization:
Monitoring that supports testing uses Cloud Monitoring to ingest events, metrics, and metadata and to provide insight through dashboards and alerts. Most Google Cloud services automatically send metrics to Cloud Monitoring, which also supports third-party sources and serves as a backend for open source tools to provide a single pane of glass. Google Cloud Managed Service for Prometheus provides a fully managed backend for Prometheus metrics, while OpenTelemetry provides an open standard for capturing metrics, traces, and logs.
Holistic monitoring gathers signals at multiple levels to reveal problems before outages and to diagnose failures. Infrastructure-level metrics capture baseline health such as CPU load, memory usage, and bytes written to disk, with an agent available for detailed data from Compute Engine VMs. App-level metrics are custom measurements defined by the team, such as query execution time, that reflect key workflows that built-in metrics cannot capture.
Monitoring across architecture layers includes:
A highly available system exposes health so traffic flows only to healthy resources. Health checks pull status from an endpoint to decide whether an instance should receive traffic from a load balancer. Load-balancer health checks evaluate VM instances and can trigger autohealing in MIGs so unhealthy machines are recreated, while Kubernetes liveness and readiness probes help the orchestrator manage pods and requests.
Resiliency testing validates that systems withstand failures and recover gracefully by deliberately causing faults in controlled environments. Chaos engineering introduces simulated failures to confirm failover mechanisms, rather than waiting for a real outage to reveal weaknesses. Google Cloud guidance points to Fault Injection Testing and simulated zonal and regional failure scenarios to practice recovery.
Google Cloud itself validates large-scale resilience with zone and region disconnect testing in a dedicated, production-equivalent environment. That environment uses an internal-only region that is architecturally identical to customer-facing regions (opens in a new tab), then its network connectivity is physically disconnected to observe behavior during total failure. Local services inside the affected area go offline as expected, while control planes and services in other zones and regions remain unaffected, with validation repeated on a consistent schedule.
Disaster recovery (DR) (opens in a new tab) simulations validate that backup, replication, and failover plans meet RTO, RPO, and data integrity requirements. RTO answers how long after a disaster until normal service resumes, while RPO answers how much data in writes can be lost before recovery. A complete restoration test restores backups in a non-production environment and then tests the full application stack with the restored data.
High availability (HA) and DR address different scopes and use different replication:
| Approach | Scope | Replication | Recovery expectation |
|---|---|---|---|
| High availability (HA) | Regional deployment across zones | Synchronous replication between zones within a single region by default | Zero or near-zero RTO and RPO with active-active topology and no single point of failure |
| Disaster recovery (DR) | Multi-region deployment across two or more regions | Typically asynchronous replication unless multi-regional or global services are used | Assessed RTO and RPO with manual or semi-automated failover |
Backup practices determine whether RPO targets can be met. Teams set backup frequency to align with RPO, so an RPO of 15 minutes requires backups at least every 15 minutes. They use Cloud Storage, Cloud SQL automated backups, Spanner backups, point-in-time recovery (PITR) for Cloud SQL, and incremental backups for large datasets, plus automated consistency checks after each backup. DR validation also confirms backup location and traffic movement by storing snapshots in multi-region locations, using cross-region replication, and distributing traffic with Cloud DNS and regional or global load balancers.
Exam tip: Load testing simulates realistic traffic patterns to check performance, while stress testing pushes the system to its limits to identify bottlenecks.
Automated testing and CI/CD pipeline integration validates every code change with automated tests before the change moves toward production. Cloud Build builds and tests artifacts, and Cloud Deploy promotes verified artifacts through target environments in a defined sequence. This combination reduces errors and regressions and ensures that only tested artifacts reach production.
Cloud Build is the service that executes builds, runs validation, and produces deployable artifacts from source code. Cloud Build can import source from Cloud Storage, Cloud Source Repositories, GitHub, or Bitbucket, pull dependencies from build configuration files, and then run static analysis, unit testing, integration testing, and end-to-end testing. Cloud Deploy is the managed delivery service that automates promotion of container images to a series of targets, such as Google Kubernetes Engine (GKE) environments.
A typical container pipeline moves data and control through an ordered flow:
A six-step left-to-right flow from trigger to deploy, with Artifact Analysis scanning the stored image and Binary Authorization checking attestations at deploy time.
This order matters because the image is stored only after tests pass, so downstream deployment depends on successful validation upstream.
Automated artifact production creates the same image the same way for every source change, with testing built into production. Each image follows the same lifecycle: first build the image, then run the test suite against it, and only after success store the image in a registry. The build should trigger automatically on every source modification so teams get immediate feedback.
Artifact identity makes each execution repeatable across development, test, and production environments. Releases are commonly tagged with semantic versioning, while pre-release images are labeled with the source point they came from, such as the Git commit hash from the main branch. Teams maintain a small set of base images to avoid unsupported runtimes, extend test suites to cover the image itself with tools such as InSpec, and inject configuration files and secrets at deploy time so the exact tested artifact moves unchanged from development to production.
Artifact Analysis is the service that automatically scans container images for known vulnerabilities before deployment. Artifact Analysis scans new images when they are uploaded to Artifact Registry, extracts information about system packages in the container, and stores vulnerability metadata with the image. After the initial scan, Artifact Analysis continuously monitors scanned images against new and updated vulnerability sources.
When new vulnerability data arrives, Artifact Analysis keeps image metadata current without requiring a new upload:
Because scanning happens at the registry boundary and continues over time, an image that was clean on upload can later be flagged if a new vulnerability affects its packages.
Binary Authorization is the deployment control that ensures only trusted code runs on GKE and Cloud Run. Binary Authorization attaches configurable signatures, called attestations, to container images, where each attestation is a digital document stating that a required process completed successfully. At deployment time, Binary Authorization checks those attestations against policy before allowing the Pod to run.
A policy can require proof that a specific build system created the image, that the image satisfies a vulnerability signing policy, and that the image meets promotion criteria for the next environment, such as from development to QA. Different policies can apply to development, test, and production so only verified artifacts advance. Continuous validation extends this check past deploy time by regularly logging policy conformance in Cloud Logging throughout the Pod lifecycle, including violations from a later policy change or from Pods deployed with dry run or breakglass. Cloud Deploy adds human oversight through gated approvals, where promotion requires an explicit approve or deny decision.
Exam tip: Artifact Analysis scans images in Artifact Registry and monitors them over time, while Binary Authorization enforces attestation policy at deployment time on GKE and Cloud Run.
Web application and supply-chain validation checks running web apps and the software supply chain before promotion to production. Web Security Scanner, part of Security Command Center, automatically checks web applications running on App Engine, Compute Engine, and GKE. The scanner crawls within the scope of the starting URLs, follows links, and exercises inputs and event handlers to find cross-site scripting, code injection, mixed content, and outdated libraries without overwhelming teams with false positives.
Broader release validation follows the Supply-chain Levels for Software Artifacts (SLSA) (opens in a new tab) framework, which requires checks for source code, build process, and code provenance. Cloud Build can surface build provenance, software bill of materials (SBOM), Vulnerability Exploitability eXchange (VEX) statements, and SLSA level for built artifacts, so security gates can block non-compliant code before Cloud Deploy promotes it.
Linting checks whether an Infrastructure as Code (IaC) template is written correctly by checking syntax, formatting, and basic configuration errors, while policy-as-code enforcement checks whether the template is allowed by security and compliance rules such as allowed regions, encryption, and identity controls. Linting runs first when the template is written or committed, and policy-as-code enforcement runs second by evaluating the template against codified policies.
Artifact Analysis automatically scans container images when they are uploaded to Artifact Registry and continuously monitors them against new vulnerability sources, while Binary Authorization enforces attestation policy at deployment time on Google Kubernetes Engine (GKE) and Cloud Run. Artifact Analysis extracts package information and updates vulnerability metadata over time, whereas Binary Authorization checks required attestations before allowing the Pod to run.
High availability (HA) is a regional deployment across zones with synchronous replication between zones within a single region, while Disaster recovery (DR) is a multi-region deployment across two or more regions with typically asynchronous replication. High availability (HA) expects zero or near-zero recovery time objective (RTO) and recovery point objective (RPO) with active-active topology, while Disaster recovery (DR) uses assessed recovery time objective (RTO) and recovery point objective (RPO) with manual or semi-automated failover.
Load testing simulates normal and peak traffic to check performance and behavior under realistic traffic patterns, while stress testing pushes the system to its limits to identify bottlenecks. Cloud Load Balancing distributes simulated traffic to test targets while external load-testing services generate realistic request patterns to measure response time and resource use.
An enterprise runs a business-critical workload on Google Cloud Compute Engine virtual machines within a regional Managed Instance Group (MIG) behind an external Application Load Balancer. The operations team is preparing a resiliency and disaster recovery testing protocol to validate high availability and failover mechanisms before a major production release.
The testing strategy must satisfy the following requirements:
Which testing and validation strategy should the team implement?
Last updated