Skip to content
Community previewValidate controls against current Google documentation.Report a gap

Configuration Management (CM) - Google Cloud Platform

This guide provides gcloud commands and automated methods for collecting evidence related to NIST SP 800-53 and FedRAMP Configuration Management (CM) family controls in Google Cloud Platform environments.

  • Cloud Asset Inventory: Track and analyze resource configurations
  • Organization Policy Service: Enforce configuration constraints
  • Deployment Manager: Infrastructure as code templates
  • Security Command Center: Configuration compliance monitoring
  • Cloud Build: Automated deployment pipelines

Export current project configuration

Terminal window
gcloud asset export \
--project=PROJECT_ID \
--output-path=gs://BUCKET_NAME/baseline-config.json \
--content-type=resource

List all Compute Engine instance templates

Terminal window
gcloud compute instance-templates list --project=PROJECT_ID

Export organization policies

Terminal window
gcloud resource-manager org-policies list \
--organization=ORGANIZATION_ID \
--format=json > org-policies-baseline.json

Capture VPC configurations

Terminal window
gcloud compute networks list --project=PROJECT_ID --format=json
gcloud compute firewall-rules list --project=PROJECT_ID --format=json

List all images in project

Terminal window
gcloud compute images list --project=PROJECT_ID

Export Deployment Manager deployments

Terminal window
gcloud deployment-manager deployments list --project=PROJECT_ID
gcloud deployment-manager deployments describe DEPLOYMENT_NAME --project=PROJECT_ID

Monitor configuration changes via audit logs

Terminal window
gcloud logging read \
"protoPayload.methodName:(\"compute.instances.insert\" OR \"compute.firewalls.patch\" OR \"storage.buckets.update\")" \
--project=PROJECT_ID \
--format=json \
--freshness=7d

List Cloud Source Repositories

Terminal window
gcloud source repos list --project=PROJECT_ID

View Cloud Build history

Terminal window
gcloud builds list --project=PROJECT_ID --limit=50

Check deployment history

Terminal window
gcloud deployment-manager deployments list --project=PROJECT_ID --format="table(name,insertTime,operation.status)"

Create custom role for configuration management

Terminal window
gcloud iam roles create configurationManager \
--organization=ORGANIZATION_ID \
--title="Configuration Manager" \
--description="Manages infrastructure configurations" \
--permissions=compute.instances.update,compute.networks.update,storage.buckets.update

List who has deployment permissions

Terminal window
gcloud projects get-iam-policy PROJECT_ID \
--flatten="bindings[].members" \
--filter="bindings.role:(roles/deploymentmanager.editor OR roles/editor OR roles/owner)" \
--format="table(bindings.members,bindings.role)"

List Security Health Analytics findings

Terminal window
gcloud scc findings list organizations/ORGANIZATION_ID \
--source=organizations/ORGANIZATION_ID/sources/SECURITY_HEALTH_ANALYTICS_SOURCE_ID \
--filter="state=\"ACTIVE\""

Check Cloud Storage bucket configurations

Terminal window
for bucket in $(gsutil ls); do
echo "Bucket: $bucket"
gsutil iam get $bucket
gsutil uniformbucketlevelaccess get $bucket
done

Verify OS Login is enabled on instances

Terminal window
gcloud compute instances list \
--format="table(name,metadata.items[key='enable-oslogin'].value)" \
--filter="metadata.items.key='enable-oslogin'"

Check project-wide metadata

Terminal window
gcloud compute project-info describe --project=PROJECT_ID --format="yaml(commonInstanceMetadata)"

List enabled APIs

Terminal window
gcloud services list --enabled --project=PROJECT_ID

Disable unnecessary APIs

Terminal window
gcloud services disable API_NAME --project=PROJECT_ID

Find unused firewall rules

Terminal window
gcloud compute firewall-rules list \
--filter="disabled=true" \
--format="table(name,creationTimestamp,disabled)"

List all running services on instances

Terminal window
gcloud compute ssh INSTANCE_NAME --command="systemctl list-units --type=service --state=running"

CM-8: Information System Component Inventory

Section titled “CM-8: Information System Component Inventory”

Export complete asset inventory

Terminal window
gcloud asset export \
--organization=ORGANIZATION_ID \
--output-path=gs://BUCKET_NAME/inventory-$(date +%Y%m%d).json \
--content-type=resource

Query specific resource types

Terminal window
gcloud asset search-all-resources \
--scope=organizations/ORGANIZATION_ID \
--asset-types=compute.googleapis.com/Instance,storage.googleapis.com/Bucket

List resources with specific labels

Terminal window
gcloud compute instances list \
--filter="labels.environment=production" \
--format="table(name,labels.environment,labels.owner,creationTimestamp)"

Export all Compute Engine resources

Terminal window
# Instances
gcloud compute instances list --format=json > instances.json
# Disks
gcloud compute disks list --format=json > disks.json
# Networks
gcloud compute networks list --format=json > networks.json
# Subnets
gcloud compute networks subnets list --format=json > subnets.json

Check organization constraints

Terminal window
gcloud resource-manager org-policies list --organization=ORGANIZATION_ID

View specific constraint details

Terminal window
gcloud resource-manager org-policies describe constraints/compute.requireOsLogin \
--organization=ORGANIZATION_ID
#!/bin/bash
# Export complete configuration baseline
PROJECT_ID="YOUR_PROJECT_ID"
ORG_ID="YOUR_ORG_ID"
OUTPUT_DIR="config_baseline_$(date +%Y%m%d)"
mkdir -p $OUTPUT_DIR
# Organization policies
gcloud resource-manager org-policies list --organization=$ORG_ID --format=json > $OUTPUT_DIR/org_policies.json
# Asset inventory
gcloud asset export \
--organization=$ORG_ID \
--output-path=gs://YOUR_BUCKET/$OUTPUT_DIR/full_inventory.json \
--content-type=resource
# Compute configurations
gcloud compute instances list --format=json > $OUTPUT_DIR/instances.json
gcloud compute firewall-rules list --format=json > $OUTPUT_DIR/firewall_rules.json
gcloud compute networks list --format=json > $OUTPUT_DIR/networks.json
gcloud compute instance-templates list --format=json > $OUTPUT_DIR/instance_templates.json
# Storage configurations
gsutil ls -L > $OUTPUT_DIR/storage_buckets.txt
# Enabled APIs
gcloud services list --enabled --format=json > $OUTPUT_DIR/enabled_apis.json
#!/bin/bash
# Detect configuration changes from baseline
BASELINE_DIR="baseline_configs"
CURRENT_DIR="current_configs_$(date +%Y%m%d)"
mkdir -p $CURRENT_DIR
# Export current configurations
gcloud compute firewall-rules list --format=json > $CURRENT_DIR/firewall_rules.json
gcloud compute instances list --format=json > $CURRENT_DIR/instances.json
# Compare with baseline
echo "=== Firewall Rules Changes ==="
diff $BASELINE_DIR/firewall_rules.json $CURRENT_DIR/firewall_rules.json
echo "=== Instance Changes ==="
diff $BASELINE_DIR/instances.json $CURRENT_DIR/instances.json
#!/bin/bash
# Monitor critical configuration changes in last 24 hours
gcloud logging read '
(protoPayload.methodName="compute.firewalls.insert" OR
protoPayload.methodName="compute.firewalls.patch" OR
protoPayload.methodName="compute.firewalls.delete" OR
protoPayload.methodName="storage.buckets.update" OR
protoPayload.methodName="compute.instances.setMetadata")' \
--project=PROJECT_ID \
--format="table(timestamp,protoPayload.authenticationInfo.principalEmail,protoPayload.methodName,protoPayload.resourceName)" \
--freshness=24h

Page provenance

Community-maintained guidance. Use the edit link below to propose a sourced correction.

Contributors

Was this page useful?

Help us prioritize the next improvement.