Prepare and test your skills

Prepare and test your skills

Configuration and inheritance in hierarchical policies is a way to define firewall rules once at a high level and enforce them across many projects. A hierarchical security policy (opens in a new tab) is created and owned at the organization or folder level, then associated with an organization, folder, or project so lower-level projects inherit its rules. This model gives central control for Google Cloud Armor web application firewall (WAF) and DDoS protection beyond individual projects.
Hierarchical security policies attach to nodes in the resource hierarchy, while service-level security policies attach directly to a workload resource. A hierarchical policy attaches to an organization, folder, or project, so it can cover many projects at once. A service-level policy attaches directly to a backend service or backend bucket for a global external Application Load Balancer or Classic Application Load Balancer, so it protects only that specific service.
Exam tip: A hierarchical policy does nothing until it is associated with an organization, folder, or project, while a service-level policy protects the backend service or backend bucket it is attached to.
Configuration of a hierarchical security policy separates ownership from enforcement through an ordered association step. The organization or folder where the policy is created owns the policy, but its rules are not applied to any resources at creation time. Enforcement begins only after association, which lets the same central team manage the rules while choosing exactly where they apply.
Inheritance in hierarchical policies means rules defined at the organization or folder level flow downward to child projects automatically. When a central administrator blocks a malicious IP range or deploys a WAF rule for a critical vulnerability at the top, every associated child project receives the same protection without separate updates. This flow from parent policy to child projects reduces misconfigurations and security gaps, while still allowing delegation by applying different policies at different folders for different teams.
Hierarchical policies are used when the same protection must apply broadly and stay uniform across the organization. Central teams use hierarchical policies to push organization-wide mitigations quickly and to enforce compliance requirements in one place.
Feature differences between policy types determine which actions and attachment points are available for each protection model. Both hierarchical and service-level policies protect the same frontend types, but they differ in where they attach and which rule actions they allow. The Goto next action is specific to hierarchical policies and passes evaluation to the next rule, which supports layered rule sets where central rules and lower-level rules combine.
| Policy type | Attachment point | Rule actions |
|---|---|---|
| Service-level backend security policy | Backend service | Allow, Deny, Redirect with GOOGLE_RECAPTCHA and EXTERNAL_302, Throttle, Rate-based ban |
| Hierarchical backend security policy | Resource hierarchy nodes at organization, folder, or project level | Allow, Deny, Redirect with only EXTERNAL_302, Goto next |
Choose a hierarchical policy when consistent, centrally managed protection is needed across many projects, and choose a service-level policy when custom actions like throttling or reCAPTCHA redirect are needed for a single backend service.
Service account-based filtering is a method in Cloud Next-Generation Firewall (Cloud NGFW) (opens in a new tab) for controlling Virtual Private Cloud (VPC) traffic by workload identity instead of IP address. A service account is an identity that is attached to a compute instance, such as a Compute Engine virtual machine (VM), and it travels with that workload. Cloud NGFW policy rules can use these identities as the source and destination, so only the intended instances can communicate even as IP addresses change.
Service accounts in firewall rules represent the application or workload running on an instance, not the network location of the instance. When a VM is created, it is configured to run as a specific service account, and all traffic from that VM carries that identity for firewall evaluation. If the VM is stopped, recreated, or assigned a new internal or external IP address, its service account stays the same. This separation of identity from network address lets the firewall recognize who is sending traffic without tracking every IP assignment.
A Cloud NGFW policy rule that uses service accounts defines who is allowed to talk to whom by naming identities on both sides of the connection. The source service account identifies the VM that initiates the traffic, and the destination service account identifies the VM that receives the traffic. Traffic flows from the source instance to the Cloud NGFW enforcement point, where the rule compares both identities and then applies its action to allow or deny the connection. The rule applies only when both identities match, so other VMs in the same VPC or subnet are not affected.
| Filtering method | What the rule matches | Behavior when IPs change |
|---|---|---|
| IP-range filtering | Source or destination IP ranges, such as a subnet CIDR | The rule must be updated when addresses change or new instances are added |
| Service-account filtering | Source and destination service accounts attached to instances | The rule continues to work because the identity stays with the workload |
Because the firewall depends on the attached service account rather than the packet's IP address, teams can allow secure communication between specific tiers, such as a frontend service account reaching a backend service account, without opening broad IP ranges.
Exam tip: Choose service accounts as source or destination when instances have ephemeral or frequently changing IPs; choose IP ranges only when the allowed senders are defined by network location.
Filtering without static IP ranges means firewall access follows the workload itself, which reduces manual updates and overly broad rules. Administrators do not need to predict every IP address or rewrite rules each time instances scale up, scale down, or are replaced. Narrow rules that name only the required source and destination service accounts enforce least privilege, because no other identity can use the same allowed path. This approach keeps VPC traffic secure while the underlying network remains dynamic.
Secure tags (opens in a new tab) are Identity and Access Management (IAM)-governed Resource Manager tags that let Cloud Next Generation Firewall (Cloud NGFW) enforce rules by workload identity. Instead of writing rules that depend on IP addresses that can change, a rule lists a tag value as its source or target and Google Cloud matches the network interfaces that carry that tag. This approach makes policy enforcement dynamic because a workload keeps its access as it moves, while the firewall continues to evaluate its tag identity.
Secure tags are IAM-governed Resource Manager tags that are created as tag keys and tag values in Resource Manager. A secure tag key used with Cloud NGFW must have its purpose attribute set to GCE_FIREWALL and must include a purpose-data attribute that cannot be changed after creation. The parent resource for a tag key can be a project or an organization, and each tag key can have up to 1,000 unique tag values created by principals with the Tag Administrator role.
The purpose-data attribute controls the scope where a secure tag can apply. A tag key can specify a single Virtual Private Cloud (VPC) network, which must be in the same project as a project-level key or in the same organization as an organization-level key. A tag key can also specify organization=auto, which identifies all VPC networks in the organization. Secure tag values are used as sources for ingress rules and as targets for ingress or egress rules in hierarchical firewall policies, global network firewall policies, and regional network firewall policies.
Secure tags provide identity-based access control because firewall decisions follow the tagged workload rather than its IP address. To use a secure tag, a tag value is bound to a virtual machine (VM) instance, and the firewall rule then applies to the network interfaces that the bound value covers. When a VM is created, replaced, or moved, the binding moves with it, so the same rule continues to allow or deny its traffic without updating IP ranges.
Access to the tags themselves is controlled by IAM, which separates network enforcement from tag administration. Only principals granted IAM permission on the tag key, tag value, and VM can create definitions and create bindings, so application owners cannot grant themselves network access by editing a VM label. This separation supports micro-segmentation, where a network is divided into small zones and each zone receives granular rules based on workload identity for both internal east-west traffic and external north-south traffic.
Bound secure tags apply to a VM network interface based on the purpose-data attribute of the parent tag key. For each tag key, only one of its tag values can be bound to a given instance, but the same value can be bound to an unlimited number of instances. Google Cloud enforces a limit of 10 tag values that apply to each network interface, and it blocks additional bindings if a new binding would exceed that limit on any interface of the VM.
A VM with two NICs in two VPC networks shows network-scoped tags applying to one NIC and organization-scoped tags applying to both, with Cloud NGFW matching source and target tags to interfaces.
For example, if nic0 is in network1 and nic1 is in network2, a value from a key scoped to network1 applies only to nic0, while a value from a key scoped to network2 applies only to nic1. A value from a key scoped to organization=auto can apply to interfaces in any VPC network of the parent organization. Secure tags can also identify interfaces in peered networks, including networks connected by VPC Network Peering and VPC spokes on the same Network Connectivity Center hub, when the tag key scope includes that other network. Once applied, packet matching works as follows:
Secure tags can also be bound to Google Kubernetes Engine (GKE) clusters and node pools for use in network firewall policies.
Network tags are simple character strings added to VM instances or instance templates without access controls. Any user who can edit a VM can add or remove a network tag, so network tags do not prove workload identity. Secure tags are IAM-governed objects with a defined parent, purpose, and scope, so only authorized tag administrators and tag users can define and assign them.
| Capability | Secure tags | Network tags |
|---|---|---|
| Access control | Governed by IAM | No access control, simple string on VM or template |
| Definition | Tag key with up to 1,000 values in a project or organization | Simple string in a project |
| Supported policies | Hierarchical, global network, and regional network firewall policies | VPC firewall rules only |
| Peered sources | Ingress sources can include peered VPC networks and Network Connectivity Center spokes when scope and connectivity allow | Not supported for peered sources |
Exam tip: Use secure tag values in hierarchical, global, and regional network firewall policies; use network tags only in VPC firewall rules.
EXTERNAL_302, and Goto next, while service-level policies support throttling and reCAPTCHA redirects for a single backend service.GCE_FIREWALL that bind to virtual machines and apply to network interfaces based on VPC scope, with a limit of 10 applying values per interface.Hierarchical security policies attach to organization, folder, or project nodes so they can cover many projects at once, while service-level security policies attach directly to a backend service or backend bucket for a global external Application Load Balancer or Classic Application Load Balancer so they protect only that specific service. Hierarchical backend security policies support Allow, Deny, Redirect with only EXTERNAL_302, and Goto next, while service-level backend security policies support Allow, Deny, Redirect with GOOGLE_RECAPTCHA and EXTERNAL_302, Throttle, and Rate-based ban. A hierarchical policy does nothing until it is associated with an organization, folder, or project.
Use service accounts as source or destination when instances have ephemeral or frequently changing IP addresses. Service-account filtering matches the source and destination service accounts attached to instances so the rule continues to work because the identity stays with the workload, while IP-range filtering matches source or destination IP ranges and must be updated when addresses change. This lets specific tiers communicate, such as a frontend service account reaching a backend service account, without opening broad IP ranges.
Secure tags are Identity and Access Management-governed Resource Manager tags with purpose GCE_FIREWALL that bind to virtual machine instances and apply to network interfaces based on Virtual Private Cloud scope. Unlike secure tags, network tags are simple character strings added to virtual machine instances or instance templates without access controls. Secure tags are used in hierarchical, global network, and regional network firewall policies, while network tags are used only in Virtual Private Cloud firewall rules.
Hierarchical security policies are created and owned at the organization or folder level and enforce rules only after association with an organization, folder, or project. After association, projects at lower levels of the hierarchy inherit the associated policy so its rules apply to their protected resources. This lets central administrators define rules once at the top, such as blocking a malicious IP range or deploying a web application firewall rule, and have every associated child project receive the same protection automatically.
Your organization wants to enforce centralized traffic filtering rules across virtual machine (VM) instances located in multiple projects. The security team requires an access control method where VM administrators cannot independently modify or bypass their instances' security classifications, overcoming the governance limitations of legacy network tags.
Which mechanism should the organization implement in Cloud NGFW policies to achieve this?
Last updated