Datadog Gold Partner logo

GCP Security 101- A Beginner’s Guide to Keeping Your Resources Safe

By Sandeep Bihani.Dec 21, 2022

Article-GCP-Security-101-A-Beginners-Guide-to-Keeping-Your-Resources-Safe

Securing your Google Cloud Platform (GCP) environment is essential to ensure the safety and integrity of your data and resources. GCP offers a range of security features and tools to help you protect your environment, but there are also a few simple steps you can take to enhance the security of your GCP account.

In this article, we’ll explore ten ways to secure your GCP environment. These steps include enabling multi-factor authentication (MFA), setting up firewall rules, using identity and access management (IAM), encrypting sensitive data, using virtual private clouds (VPCs), VPC Service Controls, Cloud Armour, Cloud Identity-Aware Proxy (Cloud IAP), regularly reviewing and monitoring your resources, and implementing security best practices.

1.Enable multi-factor authentication (MFA) for all user accounts

One of the most effective ways to secure your GCP account is to enable MFA for all user accounts. MFA requires users to provide an additional form of authentication, such as a code sent to their phone or a security key, when logging in to their GCP account. This helps to prevent unauthorized access to your account, even if someone has obtained your password.

To enable MFA for your GCP account, you’ll need to set up a security key or use a mobile app to generate the authentication code. You can then enable MFA for individual user accounts or for all users in your organization.

2. Set up firewall rules

GCP’s firewall allows you to control inbound and outbound traffic to and from your GCP resources. This is an important step in protecting your resources from external threats and unauthorized access.

To set up firewall rules, you’ll need to specify the source and destination IP addresses, protocol, and port for each rule. You can allow or deny traffic based on these criteria, and you can also specify whether the rule applies to inbound or outbound traffic.

It’s a good idea to set up firewall rules that allow only the traffic that is necessary for your resources to function properly. For example, you might allow traffic from specific IP addresses or networks, or you might allow traffic on specific ports.
With hierarchical firewall policy, you can even create a set of firewall rules at the organization or folder level that apply to all instances in your project, and then create additional sets of rules at the project level that apply only to specific instances or groups of instances. This allows you to have a high degree of flexibility and control over your network security.

3. Use identity and access management (IAM)

IAM allows you to control access to your GCP resources by setting up roles and permissions for different users and groups. This is an important step in ensuring that only authorized users have access to the resources they need.

To set up IAM in GCP, you’ll need to create one or more user accounts and assign roles to each user. There are several built-in roles available in GCP, such as “project editor,” “viewer,” and “storage object viewer,” which allow users to perform specific actions within your project. You can also create custom roles with specific permissions if the built-in roles don’t meet your needs. For example, you might create a custom role that allows a user to create and delete Compute Engine instances, but not make any other changes to your project.

GCP also allows you to set an IAM deny policy. An IAM deny policy is a type of IAM policy that explicitly denies a user or group of users access to a specific resource or action. Deny policies take precedence over allow policies, so if a user or group of users is explicitly denied access to a resource in a deny policy, they will not be able to access that resource, even if they have been granted access to it in an allow policy.

Deny policies are useful for situations where you want to ensure that certain users or groups of users are not able to perform certain actions, regardless of any other permissions they may have. For example, you might use a deny policy to prevent certain users from deleting resources in your project, or to prevent certain groups from accessing sensitive data.

4. Encrypt sensitive data

Encrypting your data helps to protect it from unauthorized access, both at rest and in transit. GCP offers several options for encrypting data, including using customer-managed encryption keys, which allow you to control the encryption keys used to encrypt your data.

You can also enable encryption by default for certain types of resources, such as Cloud Storage buckets or Compute Engine disks. This ensures that any data stored in these resources is automatically encrypted, even if you forget to manually enable encryption.

It’s a good idea to encrypt any sensitive data, such as financial or personal information, to help protect it from unauthorized access. GCP offers encryption at rest for Cloud Storage and Bigtable, and you can also use encryption for Compute Engine disks and Cloud SQL instances.

For data in transit, GCP supports Transport Layer Security (TLS) for secure communication between services. You can also use Cloud VPN to establish a secure connection between your on-premises network and your GCP resources.

5. Use virtual private clouds (VPCs)

Virtual private clouds (VPCs) allow you to create a virtual network within GCP and control access to the resources within that network. This can be a useful tool for isolating your resources and controlling access to them.

To set up a VPC in GCP, you’ll need to create one or more VPC networks and configure the network settings, such as the IP address range and subnetworks. You can then create resources within your VPC network, such as Compute Engine instances or Cloud Storage buckets, and control access to those resources using firewall rules and IAM.

Using VPCs can help to ensure that your resources are isolated from other resources in GCP, which can help to protect them from external threats.

6. VPC Service Controls

Virtual Private Cloud (VPC) service controls are a security feature in Google Cloud Platform (GCP) that allow you to control access to your resources within a VPC network. VPC service controls allow you to create a perimeter around your resources and specify which actions can be taken on those resources.

VPC service controls can help to secure your GCP environment by limiting access to your resources and ensuring that only authorized users can access and modify them. They can also help to protect your resources from external threats by creating a virtual firewall around your resources.

To use VPC service controls, you’ll need to create a VPC network and specify the resources that you want to include within the perimeter. You can then use IAM policies and firewall rules to control access to those resources.
It’s important to regularly review and update your VPC service controls to ensure that they reflect your current security needs and protect your resources appropriately.

7. Cloud Armour for your Publicly available worklaods

Google Cloud Armor is a network security service that provides distributed denial of service (DDoS) protection for Google Cloud Platform (GCP) resources, including Compute Engine and Google Kubernetes Engine (GKE) clusters. It is designed to protect against external threats such as DDoS attacks, and can also be used to protect against application-level attacks by using Web Application Firewall (WAF) rules.

Cloud Armor can be used to protect both inbound and outbound traffic to GCP resources. It uses a combination of techniques, including connection rate limiting, packet filtering, and request analysis to identify and mitigate threats.

With Cloud Armor, you can create custom security policies that define the types of traffic that are allowed or denied to your GCP resources. You can also set up alerting to notify you when traffic patterns or other security events occur.

Cloud Armor is a fully managed service, which means that Google handles the deployment, maintenance, and updates of the service for you. This allows you to focus on your applications and business, rather than worrying about security infrastructure.

Overall, Cloud Armor is a powerful tool for protecting your web applications from threats and ensuring that your users have a secure experience when accessing your applications.

8. Use Cloud Identity-Aware Proxy (Cloud IAP)

Cloud Identity-Aware Proxy (Cloud IAP) allows you to control access to your GCP resources based on the identity of the user. Cloud IAP allows you to grant or deny access to specific resources based on the user’s identity and their role in your organization. This can be a useful tool for controlling access to sensitive resources and protecting them from unauthorized access.

To use Cloud IAP, you’ll need to enable the feature for your GCP project and configure the access controls for your resources. You can use IAM roles to specify the permissions required to access each resource, and you can also use Cloud IAP to control access to resources from specific IP addresses or networks.

Cloud IAP can be used in conjunction with other security measures, such as firewall rules and MFA, to provide an additional layer of protection for your resources.

9. Regularly review and monitor your resources

Regularly reviewing and monitoring your GCP resources can help you ensure that they are secure. This can include monitoring for security threats and vulnerabilities, as well as performing regular security assessments and audits.

GCP offers a range of tools to help you monitor your resources, including Cloud Security Command Center, which allows you to detect and respond to potential security issues in your account. You can also use Logging and Monitoring to track changes to your resources and identify any potential security issues.

You can also set up security alerts to receive notifications when potential security issues are detected in your account. You can set up alerts for a variety of security events, such as suspicious login activity or changes to your firewall rules.

To set up security alerts, you’ll need to configure your alerting policies in Monitoring. You can specify the conditions that will trigger an alert, as well as the actions that should be taken when an alert is triggered.
Enabling security alerts can help you to quickly identify and respond to potential security issues in your GCP environment.

You can also look at my other article on How to monitor changes in your GCP environment and get instant alerts here.

10. Implement security best practices

In addition to the specific security measures mentioned above, it’s important to implement security best practices to help protect your GCP environment from potential security threats. Some best practices to consider include:

  • Regularly updating software: Ensuring that all software is up to date with the latest security patches can help to protect your resources from known vulnerabilities.
  • Using strong, unique passwords: Strong passwords that are unique to each user can help to prevent unauthorized access to your GCP account.
  • Limiting access to sensitive resources: Only grant access to sensitive resources to users who need it, and regularly review and revoke access as needed.
  • Conducting regular security assessments and audits: Regularly reviewing your security practices and conducting security assessments and audits can help you identify potential weaknesses in your GCP environment and take steps to address them.

By implementing these and other security best practices, you can help to protect your GCP environment from potential security threats.


Securing your GCP environment is an important aspect of protecting your data and resources. By following the steps outlined in this article, you can ensure that your GCP environment is as secure as possible. Whether you’re a small business or a large enterprise, these simple measures can help you protect your GCP environment and keep your data and resources safe.


The original article published on Medium.

Related Posts