📖 Scenario: You are managing a website hosted on Google Cloud Platform (GCP). You want to protect your website from attacks like Distributed Denial of Service (DDoS) and block malicious traffic using a Web Application Firewall (WAF).Google Cloud Armor helps you create security policies to protect your site.
🎯 Goal: Build a Google Cloud Armor security policy that blocks traffic from a specific IP address and enables a basic WAF rule to protect your website.
📋 What You'll Learn
Create a Cloud Armor security policy named my-security-policy
Add a rule to block traffic from IP address 203.0.113.5
Add a WAF rule to enable the OWASP_CRS rule set with default action deny
Attach the security policy to a backend service named my-backend-service
💡 Why This Matters
🌍 Real World
Protecting websites and applications from malicious traffic and attacks is critical for uptime and security. Cloud Armor provides scalable protection on Google Cloud.
💼 Career
Cloud security engineers and cloud architects use Cloud Armor to secure services and meet compliance requirements.
Progress0 / 4 steps
1
Create the initial Cloud Armor security policy
Create a Cloud Armor security policy named my-security-policy using the gcloud command line.
GCP
Hint
Use the gcloud compute security-policies create command with the name my-security-policy.
2
Add a rule to block traffic from a specific IP address
Add a rule to the my-security-policy that blocks traffic from IP address 203.0.113.5 with priority 1000.
GCP
Hint
Use gcloud compute security-policies rules create with priority 1000, the IP match expression, and deny action.
3
Add a WAF rule set to the security policy
Add a WAF rule set to my-security-policy enabling the OWASP_CRS rule set with default action deny and priority 2000.
GCP
Hint
Use gcloud compute security-policies rules create with priority 2000, --expression="evaluatePreconfiguredWAF('OWASP_CRS')", and --action="deny(403)".
4
Attach the security policy to the backend service
Attach the my-security-policy to the backend service named my-backend-service using the gcloud command.
GCP
Hint
Use gcloud compute backend-services update my-backend-service --security-policy=my-security-policy --global to attach the policy.
Practice
(1/5)
1. What is the main purpose of Google Cloud Armor in protecting your applications?
easy
A. To block bad traffic and protect against attacks like DDoS
B. To store application data securely
C. To manage user authentication and login
D. To monitor application performance metrics
Solution
Step 1: Understand Cloud Armor's role
Cloud Armor is designed to protect applications from harmful traffic and attacks such as Distributed Denial of Service (DDoS).
Step 2: Compare options
Options B, C, and D describe other services like storage, authentication, and monitoring, which are not Cloud Armor's main function.
Final Answer:
To block bad traffic and protect against attacks like DDoS -> Option A
Quick Check:
Cloud Armor protects apps from bad traffic = A [OK]
Hint: Cloud Armor blocks bad traffic and DDoS attacks [OK]
Common Mistakes:
Confusing Cloud Armor with storage or authentication services
Thinking Cloud Armor monitors performance instead of security
2. Which of the following is the correct way to create a Cloud Armor security policy using gcloud CLI?
easy
A. gcloud compute security-policies create my-policy --description="Protect app"
B. gcloud compute firewall-rules create my-policy --description="Protect app"
C. gcloud compute instances create my-policy --description="Protect app"
D. gcloud compute networks create my-policy --description="Protect app"
Solution
Step 1: Identify correct gcloud command for Cloud Armor policy
The command to create a Cloud Armor security policy is under 'compute security-policies create'.
Step 2: Eliminate incorrect commands
Firewall rules, instances, and networks are different resources and use different commands.
Final Answer:
gcloud compute security-policies create my-policy --description="Protect app" -> Option A
Quick Check:
Security policy creation uses 'compute security-policies create' = B [OK]
Hint: Cloud Armor policies use 'compute security-policies create' command [OK]
Common Mistakes:
Using firewall or instance commands instead of security-policies
Confusing network creation with security policy creation
3. Given this Cloud Armor rule snippet, what action will be taken for requests from IP 203.0.113.5?