---
title: Instances should use a non-default service account
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Datadog Security > OOTB Rules > Instances should use a non-default
  service account
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Instances should use a non-default service account
 
## Description{% #description %}

Attach a user-managed service account to Compute Engine instances instead of the default Compute Engine service account (`PROJECT_NUMBER-compute@developer.gserviceaccount.com`). The default service account often has broad project permissions, so a compromised instance that uses it can read or change resources across the project.

This rule fails when any service account attached to the instance is the default Compute Engine service account. It also fails when an attached service account entry has no email, because the rule cannot confirm that the entry is a user-managed account. An instance with no attached service account passes.

GKE nodes are skipped. An instance counts as a GKE node when its name starts with `gke-` and it has a non-empty `goog-k8s-cluster-name` label, which GKE applies to node VMs. The `goog-gke-node` label named by the CIS benchmark has an empty value and is not present in the collected resource data, so it is not used.

## Remediation{% #remediation %}

1. Create a user-managed service account that has only the roles the workload needs.
1. Stop the instance, attach the new service account, and start the instance, following [Change the attached service account](https://docs.cloud.google.com/compute/docs/instances/change-service-account).

## References{% #references %}

- [Service accounts](https://docs.cloud.google.com/compute/docs/access/service-accounts#default_service_account)
- [Change the attached service account](https://docs.cloud.google.com/compute/docs/instances/change-service-account)
- [Automatically applied labels](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/creating-managing-labels#automatically-applied-labels)
- [CIS Google Cloud Platform Foundation Benchmark](https://www.cisecurity.org/benchmark/google_cloud_computing_platform)
